Buffalo Eats Online API Documentation

Theme extends Model
in package

Theme model for storefront theme definitions.

Each theme defines a set of CSS custom properties (colors, fonts, border-radius) that are applied to the storefront via a static CSS file.

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.
count()  : int
Count records matching optional conditions.
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.
findBySlug()  : array<string|int, mixed>|null
Find a theme by its URL slug.
getActive()  : array<string|int, mixed>
Get all active themes ordered by sort_order.
getByCategory()  : array<string|int, mixed>
Get active themes filtered by category.
getCssVariables()  : array<string|int, mixed>
Get decoded CSS variables for a theme.
getDb()  : PDO
Get the underlying PDO connection.
getDefault()  : array<string|int, mixed>|null
Get the default theme.
paginate()  : array<string|int, mixed>
Paginate records matching conditions.
query()  : PDOStatement
Execute a raw SQL query with parameter binding.
setDefault()  : bool
Set a theme as the default, unsetting all others.
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 = ['name', 'slug', 'category', 'description', 'thumbnail_path', 'css_variables', 'is_default', 'is_active', 'sort_order']

Mass-assignable fields

$primaryKey

protected string $primaryKey = 'id'

Primary key column

$table

protected string $table = 'themes'

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>

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

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

findBySlug()

Find a theme by its URL slug.

public findBySlug(string $slug) : array<string|int, mixed>|null
Parameters
$slug : string

URL-friendly slug

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

getActive()

Get all active themes ordered by sort_order.

public getActive() : array<string|int, mixed>
Return values
array<string|int, mixed>

getByCategory()

Get active themes filtered by category.

public getByCategory(string $category) : array<string|int, mixed>
Parameters
$category : string

Theme category

Return values
array<string|int, mixed>

getCssVariables()

Get decoded CSS variables for a theme.

public getCssVariables(int $id) : array<string|int, mixed>
Parameters
$id : int

Theme ID

Return values
array<string|int, mixed>

Decoded CSS variables or empty array

getDb()

Get the underlying PDO connection.

public getDb() : PDO
Return values
PDO

getDefault()

Get the default theme.

public getDefault() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

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

setDefault()

Set a theme as the default, unsetting all others.

public setDefault(int $id) : bool
Parameters
$id : int

Theme ID to set as default

Return values
bool

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

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