33 lines
933 B
PHP
Executable file
33 lines
933 B
PHP
Executable file
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\WeekdaysEnum;
|
|
use Database\Factories\WeeklyRecurrenceFactory;
|
|
use DishPlanner\UserDish\Interfaces\FixedRecurrenceInterface;
|
|
use DishPlanner\UserDish\Interfaces\RecurrenceInterface;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
|
|
|
/**
|
|
* @property int $weekday
|
|
* @method static create(array $array)
|
|
* @method static WeeklyRecurrenceFactory factory($count = null, $state = [])
|
|
*/
|
|
class WeeklyRecurrence extends Model implements RecurrenceInterface, FixedRecurrenceInterface
|
|
{
|
|
/** @use HasFactory<WeeklyRecurrenceFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['weekday'];
|
|
|
|
protected $casts = [
|
|
'weekday' => WeekdaysEnum::class,
|
|
];
|
|
|
|
public function recurrence(): MorphOne
|
|
{
|
|
return $this->morphOne(UserDishRecurrence::class, 'recurrence');
|
|
}
|
|
}
|