WaitingList
extends Model
in package
Waiting list model for dine-in table queuing.
Manages the queue of customers waiting for tables, with notification support when their table is ready.
Tags
Table of Contents
Properties
- $db : PDO
- $fillable : array<string|int, mixed>
- $primaryKey : string
- $table : string
Methods
- __construct() : mixed
- Initialize model with database connection.
- addToQueue() : int
- Add a customer to the waiting list.
- all() : array<string|int, mixed>
- Get all records from the table.
- cancel() : bool
- Cancel a waiting list entry.
- count() : int
- Count records matching optional conditions.
- countWaiting() : int
- Count currently waiting customers.
- create() : int
- Create a new record.
- delete() : bool
- Delete a record by primary key.
- find() : array<string|int, mixed>|null
- Find a record by primary key.
- findBy() : array<string|int, mixed>|null
- Find a record by a specific field value.
- getActiveQueue() : array<string|int, mixed>
- Get all waiting customers for a business (active queue).
- getDb() : PDO
- Get the underlying PDO connection.
- getTodayList() : array<string|int, mixed>
- Get today's full waiting list (all statuses).
- markNoShow() : bool
- Mark as no-show.
- markNotified() : bool
- Record that a notification was sent.
- markSeated() : bool
- Mark a customer as seated.
- paginate() : array<string|int, mixed>
- Paginate records matching conditions.
- query() : PDOStatement
- Execute a raw SQL query with parameter binding.
- update() : bool
- Update a record by primary key.
- where() : array<string|int, mixed>
- Find records matching conditions.
- filterFillable() : array<string|int, mixed>
- Filter data to only include fillable fields.
Properties
$db
protected
PDO
$db
Database connection
$fillable
protected
array<string|int, mixed>
$fillable
= ['business_id', 'table_id', 'customer_name', 'customer_phone', 'customer_email', 'party_size', 'status', 'notes', 'notified_at', 'notification_method', 'seated_at', 'added_by']
Mass-assignable fields
$primaryKey
protected
string
$primaryKey
= 'id'
Primary key column
$table
protected
string
$table
= 'waiting_list'
Database table name
Methods
__construct()
Initialize model with database connection.
public
__construct() : mixed
addToQueue()
Add a customer to the waiting list.
public
addToQueue(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
Return values
intall()
Get all records from the table.
public
all([string $orderBy = 'id' ][, string $direction = 'ASC' ]) : array<string|int, mixed>
Parameters
- $orderBy : string = 'id'
-
Column to order by
- $direction : string = 'ASC'
-
Sort direction (ASC or DESC)
Return values
array<string|int, mixed>cancel()
Cancel a waiting list entry.
public
cancel(int $id) : bool
Parameters
- $id : int
Return values
boolcount()
Count records matching optional conditions.
public
count([array<string|int, mixed> $conditions = [] ]) : int
Parameters
- $conditions : array<string|int, mixed> = []
-
Associative array of field => value pairs
Return values
intcountWaiting()
Count currently waiting customers.
public
countWaiting(int $businessId) : int
Parameters
- $businessId : int
Return values
intcreate()
Create a new record.
public
create(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
-
Associative array of field => value pairs
Return values
int —The ID of the newly created record
delete()
Delete a record by primary key.
public
delete(int $id) : bool
Parameters
- $id : int
-
Primary key value
Return values
boolfind()
Find a record by primary key.
public
find(int $id) : array<string|int, mixed>|null
Parameters
- $id : int
-
Primary key value
Return values
array<string|int, mixed>|nullfindBy()
Find a record by a specific field value.
public
findBy(string $field, mixed $value) : array<string|int, mixed>|null
Parameters
- $field : string
-
Column name
- $value : mixed
-
Value to match
Return values
array<string|int, mixed>|nullgetActiveQueue()
Get all waiting customers for a business (active queue).
public
getActiveQueue(int $businessId) : array<string|int, mixed>
Parameters
- $businessId : int
Return values
array<string|int, mixed>getDb()
Get the underlying PDO connection.
public
getDb() : PDO
Return values
PDOgetTodayList()
Get today's full waiting list (all statuses).
public
getTodayList(int $businessId) : array<string|int, mixed>
Parameters
- $businessId : int
Return values
array<string|int, mixed>markNoShow()
Mark as no-show.
public
markNoShow(int $id) : bool
Parameters
- $id : int
Return values
boolmarkNotified()
Record that a notification was sent.
public
markNotified(int $id, string $method) : bool
Parameters
- $id : int
- $method : string
-
email|sms|both
Return values
boolmarkSeated()
Mark a customer as seated.
public
markSeated(int $id[, int|null $tableId = null ]) : bool
Parameters
- $id : int
- $tableId : int|null = null
Return values
boolpaginate()
Paginate records matching conditions.
public
paginate(array<string|int, mixed> $conditions, int $page, int $perPage[, string $orderBy = 'id' ][, string $direction = 'ASC' ]) : array<string|int, mixed>
Parameters
- $conditions : array<string|int, mixed>
-
Associative array of field => value pairs
- $page : int
-
Current page number (1-based)
- $perPage : int
-
Records per page
- $orderBy : string = 'id'
-
Column to order by
- $direction : string = 'ASC'
-
Sort direction (ASC or DESC)
Return values
array<string|int, mixed> —Pagination result with data, total, page, per_page, total_pages
query()
Execute a raw SQL query with parameter binding.
public
query(string $sql[, array<string|int, mixed> $params = [] ]) : PDOStatement
Parameters
- $sql : string
-
SQL query string
- $params : array<string|int, mixed> = []
-
Bound parameters
Return values
PDOStatementupdate()
Update a record by primary key.
public
update(int $id, array<string|int, mixed> $data) : bool
Parameters
- $id : int
-
Primary key value
- $data : array<string|int, mixed>
-
Associative array of field => value pairs
Return values
boolwhere()
Find records matching conditions.
public
where(array<string|int, mixed> $conditions[, string $orderBy = 'id' ][, string $direction = 'ASC' ]) : array<string|int, mixed>
Parameters
- $conditions : array<string|int, mixed>
-
Associative array of field => value pairs
- $orderBy : string = 'id'
-
Column to order by
- $direction : string = 'ASC'
-
Sort direction
Return values
array<string|int, mixed>filterFillable()
Filter data to only include fillable fields.
protected
filterFillable(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
Input data
Return values
array<string|int, mixed> —Filtered data