59 lines
1.4 KiB
PHP
Executable File
59 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;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property string $name
|
|
* @property string $pdf_path
|
|
* @property string|null $extracted_content
|
|
* @property string $processing_status
|
|
* @property string|null $error_message
|
|
* @property bool $is_active
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read User $user
|
|
* @property-read Collection<int, CustomSubjectQuestion> $questions
|
|
*/
|
|
class CustomSubject extends Model
|
|
{
|
|
/** @var array<int, string> */
|
|
protected $fillable = [
|
|
'user_id',
|
|
'name',
|
|
'pdf_path',
|
|
'extracted_content',
|
|
'processing_status',
|
|
'error_message',
|
|
'is_active',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Get the user who owns the custom subject.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the questions for this custom subject.
|
|
*/
|
|
public function questions(): HasMany
|
|
{
|
|
return $this->hasMany(CustomSubjectQuestion::class);
|
|
}
|
|
}
|