32 lines
862 B
PHP
32 lines
862 B
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_type', 'discount_type', 'discount_value', 'starts_at', 'ends_at', 'description', 'is_active'])]
|
|
class Promotion extends Model
|
|
{
|
|
use BelongsToOrganization;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'machine_type' => 'string',
|
|
'discount_type' => 'string',
|
|
'discount_value' => 'decimal:2',
|
|
'starts_at' => 'datetime',
|
|
'ends_at' => 'datetime',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function establishment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Establishment::class);
|
|
}
|
|
}
|