39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BelongsToOrganization;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable(['establishment_id', 'machine_id', 'machine_type', 'day_type', 'slot_start', 'slot_end', 'price', 'label', 'requires_app', 'priority', 'is_active'])]
|
|
class PricingRule extends Model
|
|
{
|
|
use BelongsToOrganization;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'machine_type' => 'string',
|
|
'day_type' => 'string',
|
|
'slot_start' => 'datetime:H:i:s',
|
|
'slot_end' => 'datetime:H:i:s',
|
|
'price' => 'decimal:2',
|
|
'requires_app' => 'boolean',
|
|
'priority' => 'integer',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function establishment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Establishment::class);
|
|
}
|
|
|
|
public function machine(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Machine::class);
|
|
}
|
|
}
|