62 lines
1.4 KiB
PHP
Executable File
62 lines
1.4 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 $custom_subject_id
|
|
* @property int $user_id
|
|
* @property string $question
|
|
* @property string|null $answer
|
|
* @property string|null $provider
|
|
* @property string|null $model
|
|
* @property int $input_tokens
|
|
* @property int $output_tokens
|
|
* @property \Illuminate\Support\Carbon $asked_at
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read CustomSubject $customSubject
|
|
* @property-read User $user
|
|
*/
|
|
class CustomSubjectQuestion extends Model
|
|
{
|
|
/** @var array<int, string> */
|
|
protected $fillable = [
|
|
'custom_subject_id',
|
|
'user_id',
|
|
'question',
|
|
'answer',
|
|
'provider',
|
|
'model',
|
|
'input_tokens',
|
|
'output_tokens',
|
|
'asked_at',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = [
|
|
'asked_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Get the custom subject associated with this question.
|
|
*/
|
|
public function customSubject(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CustomSubject::class);
|
|
}
|
|
|
|
/**
|
|
* Get the user who asked this question.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|