2024-07-23 16:40:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
class Chat extends Model
|
|
|
|
{
|
2024-07-24 17:16:41 +00:00
|
|
|
public const ROLE_USER = 'user';
|
|
|
|
|
|
|
|
public const ROLE_ASSISTANT = 'assistant';
|
|
|
|
|
|
|
|
public const ROLE_SYSTEM = 'system';
|
|
|
|
|
|
|
|
public const ROLE_META = 'meta';
|
|
|
|
|
2024-07-23 16:40:56 +00:00
|
|
|
protected $fillable = [
|
|
|
|
'name',
|
|
|
|
'assistant_id',
|
|
|
|
'user_id',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function assistant(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Assistant::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function histories(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(ChatHistory::class);
|
|
|
|
}
|
|
|
|
}
|