First Commit
This commit is contained in:
Executable
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\MessageType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $subject_id
|
||||
* @property string $content
|
||||
* @property string $type
|
||||
* @property array|null $metadata
|
||||
* @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
|
||||
* @property-read Subject $subject
|
||||
*/
|
||||
class Insight extends Model
|
||||
{
|
||||
/** @var array<int, string> */
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'subject_id',
|
||||
'content',
|
||||
'type',
|
||||
'metadata',
|
||||
'input_tokens',
|
||||
'output_tokens',
|
||||
'sent_at',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
protected $casts = [
|
||||
'metadata' => 'array',
|
||||
'sent_at' => 'datetime',
|
||||
'type' => MessageType::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user that owns the insight.
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subject associated with the insight.
|
||||
*/
|
||||
public function subject(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Subject::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user