tab_tickets_types
in package
Class tab_tickets_types
Represents a database table for ticket types.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- $db : db_master
Methods
- __construct() : mixed
- Constructs a new instance of the class.
- __destruct() : mixed
- Destructor for the class.
- all() : array<string|int, mixed>|bool
- Fetches all ticket types from the database.
- delete() : bool
- Deletes a record from the `tickets_types` table based on the given column and value.
- get() : array<string|int, mixed>|bool
- Fetches a single ticket type record from the database based on a specified value and column.
- insert() : bool
- Inserts a new record into the tickets_types table.
- update() : bool
- Updates a record in the `tickets_types` table based on the given column, value, and ID.
Properties
$allowedCols
protected
array<string|int, mixed>
$allowedCols
= ['id', 'name', 'icon', 'bg', 'cssicon']
An array containing the allowed columns for data retrieval. The order of the columns is important and should be maintained. Each element should be a string representing the name of the column.
$db
protected
db_master
$db
Tags
Methods
__construct()
Constructs a new instance of the class.
public
__construct() : mixed
Initializes the $db
property with the global $dbm
object.
__destruct()
Destructor for the class.
public
__destruct() : mixed
Unsets the 'db' and 'allowedCols' properties to clean up resources when the object is destroyed.
all()
Fetches all ticket types from the database.
public
all([string $sort = 'id' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'id'
-
(optional) The column to sort the results by. Default is 'id'.
- $order : string = 'ASC'
-
(optional) The order in which to sort the results. Default is 'ASC'.
Return values
array<string|int, mixed>|bool —An array of ticket type records if found, or false if no records found.
delete()
Deletes a record from the `tickets_types` table based on the given column and value.
public
delete(string $val[, string $col = 'id' ]) : bool
Parameters
- $val : string
-
The value to look for in the specified column. Must be a string.
- $col : string = 'id'
-
The column to search for the value. Default is 'id'. Must be a string.
Return values
bool —Returns true if the record was successfully deleted, false otherwise.
get()
Fetches a single ticket type record from the database based on a specified value and column.
public
get(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to match in the specified column.
- $col : string = 'id'
-
(optional) The column to search in. Default is 'id'.
Return values
array<string|int, mixed>|bool —The ticket type record if found, or false if no record found.
insert()
Inserts a new record into the tickets_types table.
public
insert(string $name, string $icon, string $bg, string $cssicon) : bool
Parameters
- $name : string
-
The name of the ticket type.
- $icon : string
-
The icon for the ticket type.
- $bg : string
-
The background color for the ticket type.
- $cssicon : string
-
The CSS icon class for the ticket type.
Return values
bool —Returns true if the record was successfully inserted, false otherwise.
update()
Updates a record in the `tickets_types` table based on the given column, value, and ID.
public
update(string $val, string $col, string $id) : bool
Parameters
- $val : string
-
The new value to update in the specified column. Must be a string.
- $col : string
-
The column to update with the new value. Must be a string.
- $id : string
-
The ID of the record to update. Must be a string.
Return values
bool —Returns true if the record was successfully updated, false otherwise.