59 lines
1.4 KiB
PHP
Executable File
59 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $subject_id
|
|
* @property string $frequency
|
|
* @property array|null $weekdays
|
|
* @property string|null $preferred_time
|
|
* @property bool $is_active
|
|
* @property \Illuminate\Support\Carbon|null $last_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 InsightSchedule extends Model
|
|
{
|
|
/** @var array<int, string> */
|
|
protected $fillable = [
|
|
'user_id',
|
|
'subject_id',
|
|
'frequency',
|
|
'weekdays',
|
|
'preferred_time',
|
|
'is_active',
|
|
'last_sent_at',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = [
|
|
'weekdays' => 'array',
|
|
'is_active' => 'boolean',
|
|
'last_sent_at' => 'datetime',
|
|
'preferred_time' => 'datetime:H:i',
|
|
];
|
|
|
|
/**
|
|
* Get the user associated with this schedule.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the subject associated with this schedule.
|
|
*/
|
|
public function subject(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Subject::class);
|
|
}
|
|
}
|