First Commit
This commit is contained in:
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
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|null $user_id
|
||||
* @property string $name
|
||||
* @property string|null $description
|
||||
* @property string|null $introduction
|
||||
* @property bool $is_system
|
||||
* @property bool $is_active
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read User|null $user
|
||||
* @property-read Collection<int, UserSubject> $userSubjects
|
||||
* @property-read Collection<int, Insight> $insights
|
||||
*/
|
||||
class Subject extends Model
|
||||
{
|
||||
/** @var array<int, string> */
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'name',
|
||||
'description',
|
||||
'introduction',
|
||||
'message_type',
|
||||
'custom_instructions',
|
||||
'is_system',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
protected $casts = [
|
||||
'is_system' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user who created the subject.
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user subjects associated with this subject.
|
||||
*/
|
||||
public function userSubjects(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserSubject::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the insights associated with this subject.
|
||||
*/
|
||||
public function insights(): HasMany
|
||||
{
|
||||
return $this->hasMany(Insight::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user