ReservationService
in package
Reservation creation and availability service.
Coordinates reservation creation, time slot availability, and validation.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Initialize the reservation service.
- createReservation() : array<string|int, mixed>
- Create a reservation.
- getAvailableTimeSlots() : array<string|int, mixed>
- Get available time slots for a given date and party size.
- isSlotAvailable() : bool
- Check if a specific time slot is available.
Properties
$hoursModel
private
BusinessHour
$hoursModel
Business hours model
$reservationModel
private
Reservation
$reservationModel
Reservation model
$tableModel
private
RestaurantTable
$tableModel
Table model
Methods
__construct()
Initialize the reservation service.
public
__construct() : mixed
createReservation()
Create a reservation.
public
createReservation(int $businessId, int|null $customerId, array<string|int, mixed> $formData, array<string|int, mixed> $business) : array<string|int, mixed>
Parameters
- $businessId : int
-
Business ID
- $customerId : int|null
-
Customer ID (null for guest)
- $formData : array<string|int, mixed>
-
Reservation form data
- $business : array<string|int, mixed>
-
Business record with reservation settings
Return values
array<string|int, mixed> —Result with keys: success, reservation, error
getAvailableTimeSlots()
Get available time slots for a given date and party size.
public
getAvailableTimeSlots(int $businessId, string $date, int $partySize, array<string|int, mixed> $business) : array<string|int, mixed>
Parameters
- $businessId : int
-
Business ID
- $date : string
-
Date (Y-m-d)
- $partySize : int
-
Number of guests
- $business : array<string|int, mixed>
-
Business record with reservation settings
Return values
array<string|int, mixed> —List of available time strings (H:i)
isSlotAvailable()
Check if a specific time slot is available.
public
isSlotAvailable(int $businessId, string $date, string $time, int $partySize, array<string|int, mixed> $business) : bool
Parameters
- $businessId : int
-
Business ID
- $date : string
-
Date (Y-m-d)
- $time : string
-
Time (H:i:s)
- $partySize : int
-
Number of guests
- $business : array<string|int, mixed>
-
Business record with reservation settings