52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Ticketing\Desfile\Models;
|
|
|
|
use App\Domains\Commerce\Catalog\Models\Inventory;
|
|
use App\Domains\Commerce\Catalog\Models\Variant;
|
|
use App\Domains\Ticketing\Desfile\Enums\EntryReservationPaymentType;
|
|
use App\Domains\Ticketing\Ticket\Models\Ticket;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'variant_id',
|
|
'ticket_id',
|
|
'inventory_id',
|
|
'batch_id',
|
|
'fecha_reserva',
|
|
'importe',
|
|
'tipo_pago',
|
|
])]
|
|
class EntryReservation extends Model
|
|
{
|
|
protected $table = 'desfile_entry_reservations';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'variant_id' => 'integer',
|
|
'fecha_reserva' => 'datetime',
|
|
'importe' => 'decimal:2',
|
|
'tipo_pago' => EntryReservationPaymentType::class,
|
|
];
|
|
}
|
|
|
|
/** @return BelongsTo<Variant, $this> */
|
|
public function variant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Variant::class)->withTrashed();
|
|
}
|
|
|
|
public function ticket(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ticket::class);
|
|
}
|
|
|
|
public function inventory(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Inventory::class);
|
|
}
|
|
}
|