65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\IntToEpochCast;
|
|
use App\Enums\WeekDay;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Kwaadpepper\Enum\Traits\CastsEnums;
|
|
|
|
class TimeslotSetting extends Model
|
|
{
|
|
use CastsEnums;
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'morning_start' => IntToEpochCast::class,
|
|
'morning_end' => IntToEpochCast::class,
|
|
'afternoon_start' => IntToEpochCast::class,
|
|
'afternoon_end' => IntToEpochCast::class,
|
|
'interval' => IntToEpochCast::class,
|
|
'min_order_preparation' => IntToEpochCast::class,
|
|
];
|
|
|
|
/**
|
|
* Map attribute names to enum classes.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $enumCasts = [
|
|
'day' => WeekDay::class
|
|
];
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'morning_start',
|
|
'morning_end',
|
|
'afternoon_start',
|
|
'afternoon_end',
|
|
'interval',
|
|
'min_order_preparation',
|
|
'max_orders_per_interval',
|
|
];
|
|
|
|
// * RELATIIONSHIPS
|
|
|
|
/**
|
|
* BelongsTo shop relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function shop()
|
|
{
|
|
return $this->belongsTo(Shop::class);
|
|
}
|
|
}
|