# fluent-support/2.4.5/app/Models/AIActivityLogs.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version 2.4.5. 54 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/2.4.5/code/app/Models/AIActivityLogs.php
- Raw: https://pluginprobe.com/plugins/fluent-support/2.4.5/raw/app/Models/AIActivityLogs.php
- Modified: 2026-10-09T15:31:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-support/2.4.5/code/app/Models/AIActivityLogs.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Models;

class AIActivityLogs extends Model
{
    protected $table = 'fs_ai_activity_logs';

    protected $fillable = ['agent_id', 'ticket_id', 'model_name', 'tokens', 'prompt'];

    public static function boot()
    {
        parent::boot();

        static::creating(function ($model) {
            $model->created_at = current_time('mysql');
            $model->updated_at = current_time('mysql');
        });
    }

    /**
     * The table is created when an AI integration is first turned on, not on
     * activation, so readers check for it first.
     *
     * @return bool
     */
    public static function tableExists()
    {
        global $wpdb;

        $table = $wpdb->prefix . 'fs_ai_activity_logs';

        return $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($table))) === $table;
    }

    public function person()
    {
        $class = __NAMESPACE__ . '\Person';

        return $this->belongsTo(
            $class, 'agent_id', 'id'
        );
    }

    public function ticket()
    {
        $class = __NAMESPACE__ . '\Ticket';

        return $this->belongsTo(
            $class, 'ticket_id', 'id'
        );
    }
}

```
