2024-10-31 12:09:06 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
2025-01-28 17:14:49 -06:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-10-31 12:09:06 -05:00
|
|
|
|
|
|
|
|
class AiChat extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasUuids;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'role',
|
2025-01-28 17:14:49 -06:00
|
|
|
'content',
|
2024-10-31 12:09:06 -05:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $hidden = [];
|
|
|
|
|
|
|
|
|
|
protected static function boot()
|
|
|
|
|
{
|
|
|
|
|
parent::boot();
|
|
|
|
|
|
|
|
|
|
static::creating(function ($chat) {
|
|
|
|
|
|
|
|
|
|
$chat->user_id = auth()->user()->id;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-28 17:14:49 -06:00
|
|
|
public function user()
|
|
|
|
|
{
|
2024-10-31 12:09:06 -05:00
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function chatable()
|
|
|
|
|
{
|
|
|
|
|
return $this->morphTo();
|
|
|
|
|
}
|
|
|
|
|
}
|