PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
fluent-support / app / Models / AIActivityLogs.php

AIActivityLogs.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.4.5, at app/Models/AIActivityLogs.php

54 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /**
22 * The table is created when an AI integration is first turned on, not on
23 * activation, so readers check for it first.
24 *
25 * @return bool
26 */
27 public static function tableExists()
28 {
29 global $wpdb;
30
31 $table = $wpdb->prefix . 'fs_ai_activity_logs';
32
33 return $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($table))) === $table;
34 }
35
36 public function person()
37 {
38 $class = __NAMESPACE__ . '\Person';
39
40 return $this->belongsTo(
41 $class, 'agent_id', 'id'
42 );
43 }
44
45 public function ticket()
46 {
47 $class = __NAMESPACE__ . '\Ticket';
48
49 return $this->belongsTo(
50 $class, 'ticket_id', 'id'
51 );
52 }
53 }
54