Files
2026-09-01 07:49:48 -03:00

53 lines
1.2 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $user_id
* @property string $message
* @property string|null $response
* @property string|null $provider
* @property string|null $model
* @property int $input_tokens
* @property int $output_tokens
* @property \Illuminate\Support\Carbon|null $sent_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read User $user
*/
class ChatMessage extends Model
{
/** @var array<int, string> */
protected $fillable = [
'user_id',
'message',
'response',
'provider',
'model',
'input_tokens',
'output_tokens',
'sent_at',
];
/** @var array<string, string> */
protected $casts = [
'input_tokens' => 'integer',
'output_tokens' => 'integer',
'sent_at' => 'datetime',
];
/**
* Get the user that owns the chat message.
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}