Buffalo Eats Online API Documentation

Reservation extends Model
in package

Reservation model for table reservations.

Tags
author

J.J. Johnson visionquest716@gmail.com

copyright

2026 VisionQuestServices LLC

Table of Contents

Properties

$db  : PDO
$fillable  : array<string|int, mixed>
$primaryKey  : string
$table  : string

Methods

__construct()  : mixed
Initialize model with database connection.
all()  : array<string|int, mixed>
Get all records from the table.
assignTable()  : bool
Assign a table to a reservation.
count()  : int
Count records matching optional conditions.
countForBusiness()  : int
Count reservations for a business, optionally by status.
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.
generateConfirmation()  : string
Generate a unique confirmation number (RES-XXXXXX).
getByConfirmation()  : array<string|int, mixed>|null
Find a reservation by its confirmation number.
getDb()  : PDO
Get the underlying PDO connection.
getForBusiness()  : array<string|int, mixed>
Get reservations for a business, optionally filtered by status.
getForCustomer()  : array<string|int, mixed>
Get reservations for a customer.
getForDate()  : array<string|int, mixed>
Get reservations for a specific date.
getTodayForBusiness()  : array<string|int, mixed>
Get today's reservations for a business.
getUpcoming()  : array<string|int, mixed>
Get upcoming reservations for a business (today and future).
paginate()  : array<string|int, mixed>
Paginate records matching conditions.
query()  : PDOStatement
Execute a raw SQL query with parameter binding.
search()  : array<string|int, mixed>
Search reservations by confirmation number, guest name, or email.
update()  : bool
Update a record by primary key.
updateStatus()  : bool
Update the status of a reservation.
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', 'customer_id', 'table_id', 'confirmation_number', 'status', 'guest_name', 'guest_phone', 'guest_email', 'party_size', 'reservation_date', 'reservation_time', 'duration_minutes', 'special_requests', 'notes']

Mass-assignable fields

$primaryKey

protected string $primaryKey = 'id'

Primary key column

$table

protected string $table = 'reservations'

Database table name

Methods

__construct()

Initialize model with database connection.

public __construct() : mixed

all()

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>

assignTable()

Assign a table to a reservation.

public assignTable(int $id, int $tableId) : bool
Parameters
$id : int

Reservation ID

$tableId : int

Table ID

Return values
bool

count()

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
int

countForBusiness()

Count reservations for a business, optionally by status.

public countForBusiness(int $businessId[, string|null $status = null ]) : int
Parameters
$businessId : int

Business ID

$status : string|null = null

Optional status filter

Return values
int

create()

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
bool

find()

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>|null

findBy()

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>|null

generateConfirmation()

Generate a unique confirmation number (RES-XXXXXX).

public generateConfirmation() : string
Return values
string

getByConfirmation()

Find a reservation by its confirmation number.

public getByConfirmation(string $confirmationNumber) : array<string|int, mixed>|null
Parameters
$confirmationNumber : string

Confirmation number (e.g., RES-XXXXXX)

Return values
array<string|int, mixed>|null

getDb()

Get the underlying PDO connection.

public getDb() : PDO
Return values
PDO

getForBusiness()

Get reservations for a business, optionally filtered by status.

public getForBusiness(int $businessId[, string|null $status = null ][, int $limit = 50 ][, int $offset = 0 ]) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

$status : string|null = null

Optional status filter

$limit : int = 50

Max results

$offset : int = 0
Return values
array<string|int, mixed>

getForCustomer()

Get reservations for a customer.

public getForCustomer(int $customerId[, int $limit = 50 ][, int|null $businessId = null ]) : array<string|int, mixed>
Parameters
$customerId : int

Customer ID

$limit : int = 50

Max results

$businessId : int|null = null
Return values
array<string|int, mixed>

getForDate()

Get reservations for a specific date.

public getForDate(int $businessId, string $date) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

$date : string

Date (Y-m-d)

Return values
array<string|int, mixed>

getTodayForBusiness()

Get today's reservations for a business.

public getTodayForBusiness(int $businessId) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

Return values
array<string|int, mixed>

getUpcoming()

Get upcoming reservations for a business (today and future).

public getUpcoming(int $businessId[, int $limit = 10 ]) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

$limit : int = 10

Max results

Return values
array<string|int, mixed>

paginate()

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
PDOStatement

Search reservations by confirmation number, guest name, or email.

public search(int $businessId, string $query) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

$query : string

Search query

Return values
array<string|int, mixed>

update()

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
bool

updateStatus()

Update the status of a reservation.

public updateStatus(int $id, string $status) : bool
Parameters
$id : int

Reservation ID

$status : string

New status

Return values
bool

where()

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


        
On this page

Search results