| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentSupport\App\Models; |
| 4 |
|
| 5 |
class AIActivityLogs extends Model |
| 6 |
{ |
| 7 |
protected $table = 'fs_ai_activity_logs'; |
| 8 |
|
| 9 |
protected $fillable = ['agent_id', 'ticket_id', 'model_name', 'tokens', 'prompt']; |
| 10 |
|
| 11 |
public static function boot() |
| 12 |
{ |
| 13 |
parent::boot(); |
| 14 |
|
| 15 |
static::creating(function ($model) { |
| 16 |
$model->created_at = current_time('mysql'); |
| 17 |
$model->updated_at = current_time('mysql'); |
| 18 |
}); |
| 19 |
} |
| 20 |
|
| 21 |
public function person() |
| 22 |
{ |
| 23 |
$class = __NAMESPACE__ . '\Person'; |
| 24 |
|
| 25 |
return $this->belongsTo( |
| 26 |
$class, 'agent_id', 'id' |
| 27 |
); |
| 28 |
} |
| 29 |
|
| 30 |
public function ticket() |
| 31 |
{ |
| 32 |
$class = __NAMESPACE__ . '\Ticket'; |
| 33 |
|
| 34 |
return $this->belongsTo( |
| 35 |
$class, 'ticket_id', 'id' |
| 36 |
); |
| 37 |
} |
| 38 |
} |
| 39 |
|