feat: establish reservation portal foundation
This commit is contained in:
40
app/Domain/Reservations/Models/ReservationItem.php
Normal file
40
app/Domain/Reservations/Models/ReservationItem.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Reservations\Models;
|
||||
|
||||
use App\Domain\Inventory\Models\SnipeAsset;
|
||||
use App\Domain\Reservations\Enums\ReservationItemStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ReservationItem extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'reservation_id', 'snipe_asset_id', 'starts_at', 'ends_at', 'status',
|
||||
'delivered_at', 'returned_at', 'checkout_reference', 'checkin_reference',
|
||||
'condition_out', 'condition_in', 'notes',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => ReservationItemStatus::class,
|
||||
'starts_at' => 'immutable_datetime',
|
||||
'ends_at' => 'immutable_datetime',
|
||||
'delivered_at' => 'immutable_datetime',
|
||||
'returned_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/** @return BelongsTo<Reservation, $this> */
|
||||
public function reservation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Reservation::class);
|
||||
}
|
||||
|
||||
/** @return BelongsTo<SnipeAsset, $this> */
|
||||
public function asset(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SnipeAsset::class, 'snipe_asset_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user