47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Operations\Models;
|
|
|
|
use App\Domain\Operations\Enums\HandoverType;
|
|
use App\Domain\Reservations\Models\ReservationItem;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class HandoverRecord extends Model
|
|
{
|
|
public const UPDATED_AT = null;
|
|
|
|
protected $fillable = [
|
|
'reservation_item_id', 'type', 'operator_id', 'recipient_id',
|
|
'condition', 'notes', 'snipe_response', 'created_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => HandoverType::class,
|
|
'snipe_response' => 'array',
|
|
'created_at' => 'immutable_datetime',
|
|
];
|
|
}
|
|
|
|
/** @return BelongsTo<ReservationItem, $this> */
|
|
public function reservationItem(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ReservationItem::class);
|
|
}
|
|
|
|
/** @return BelongsTo<User, $this> */
|
|
public function operator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'operator_id');
|
|
}
|
|
|
|
/** @return BelongsTo<User, $this> */
|
|
public function recipient(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'recipient_id');
|
|
}
|
|
}
|