Attainly/backend/app/Schedule/ScheduleAssignmentModel.php

59 lines
1.4 KiB
PHP

<?php
namespace App\Schedule;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $schedule_id
* @property string $element_name
* @property string $element_kind
* @property list<string> $element_path
* @property string $scheduled_date
* @property int $position
* @property-read ScheduleModel $schedule
*
* @method static Builder<static>|ScheduleAssignmentModel newModelQuery()
* @method static Builder<static>|ScheduleAssignmentModel newQuery()
* @method static Builder<static>|ScheduleAssignmentModel query()
*
* @mixin \Eloquent
*/
#[Fillable([
'schedule_id',
'element_name',
'element_kind',
'element_path',
'scheduled_date',
'position',
])]
class ScheduleAssignmentModel extends Model
{
protected $table = 'schedule_assignments';
public $timestamps = false;
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'schedule_id' => 'integer',
'element_path' => 'array',
'position' => 'integer',
];
}
/**
* @return BelongsTo<ScheduleModel, $this>
*/
public function schedule(): BelongsTo
{
return $this->belongsTo(ScheduleModel::class, 'schedule_id');
}
}