wip: improved booking summary
This commit is contained in:
@@ -188,12 +188,16 @@ class Travel
|
||||
* greater than zero and have an available status. This ensures only
|
||||
* bookable rooms are returned for selection.
|
||||
*
|
||||
* @return array<Room> The filtered array of available rooms
|
||||
* @return array<int, Room> The filtered array of available rooms, indexed by room ID
|
||||
*/
|
||||
public function getAvailableRooms(): array
|
||||
{
|
||||
return array_filter($this->rooms, function (Room $room) {
|
||||
return $room->available > 0 && Constants::STATUS_AVAILABLE === $room->status;
|
||||
});
|
||||
$result = [];
|
||||
foreach ($this->rooms as $room) {
|
||||
if ($room->available > 0 && Constants::STATUS_AVAILABLE === $room->status) {
|
||||
$result[$room->id] = $room;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user