tab_tickets_appointments
in package
Class tab_tickets_appointments
Represents a class for managing tickets appointments in a database.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- $db : db_tenant
Methods
- __construct() : mixed
- Constructs a new instance of the class
- __destruct() : mixed
- Destructor method.
- delete() : bool
- Deletes a record from the `tickets_appointments` table based on the specified column and value.
- get() : array<string|int, mixed>|bool
- Retrieves a single record from the database table `tickets_appointments`
- getall() : array<string|int, mixed>|bool
- Retrieves all records from the database table `tickets_appointments`
- getdatabase() : string|false
- Retrieves the name of the current database.
- insert() : int|string|bool
- Inserts a new record into the `tickets_appointments` table.
- update() : bool
- Updates a record in the `tickets_appointments` table based on the specified column, value, and ID.
Properties
$allowedCols
protected
array<string|int, mixed>
$allowedCols
= ['id', 'tid', 'tnumber', 'start', 'duration', 'type', 'send']
An array containing allowed column names. The values in this array represent the column names that are allowed to be used. Example: ['id', 'tid', 'tnumber', 'start', 'duration', 'type', 'send']
$db
protected
db_tenant
$db
- The instance of the DatabaseConnection class that provides the connection to the database.
Methods
__construct()
Constructs a new instance of the class
public
__construct() : mixed
__destruct()
Destructor method.
public
__destruct() : mixed
Unsets the $db and $allowedCols properties.
delete()
Deletes a record from the `tickets_appointments` table based on the specified column and value.
public
delete(string $val[, string $col = 'tid' ]) : bool
Parameters
- $val : string
-
The value to match in the specified column (default: "tid").
- $col : string = 'tid'
-
The column to search for the specified value (default: "tid").
Return values
bool —Returns true if the record is successfully deleted, false otherwise.
get()
Retrieves a single record from the database table `tickets_appointments`
public
get(string $val[, string $col = 'tid' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column
- $col : string = 'tid'
-
The column to search for the specified value (default: 'tid')
Return values
array<string|int, mixed>|bool —Returns the matching record if successful, or false if the column is not allowed or no record found
getall()
Retrieves all records from the database table `tickets_appointments`
public
getall(string $val[, string $col = 'tid' ][, string $sort = 'start' ][, string $order = 'DESC' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column
- $col : string = 'tid'
-
The column to search for the specified value (default: 'tid')
- $sort : string = 'start'
-
The column to use for sorting the result set (default: 'start')
- $order : string = 'DESC'
-
The sorting order ('ASC' for ascending or 'DESC' for descending) (default: 'DESC')
Return values
array<string|int, mixed>|bool —Returns an array of records if successful, or false if the column is not allowed or no records found
getdatabase()
Retrieves the name of the current database.
public
getdatabase() : string|false
Return values
string|false —The name of the database if it exists, false otherwise.
insert()
Inserts a new record into the `tickets_appointments` table.
public
insert(string $tid, string $tnumber, string $start[, string $dur = '15' ][, string $type = '0' ]) : int|string|bool
Parameters
- $tid : string
-
The ID of the ticket.
- $tnumber : string
-
The ticket number.
- $start : string
-
The start date of the appointment.
- $dur : string = '15'
-
The duration of the appointment. Default value is '15'.
- $type : string = '0'
-
The type of the appointment. Default value is '0'.
Return values
int|string|bool —The ID of the inserted record if insertion is successful, false otherwise.
update()
Updates a record in the `tickets_appointments` table based on the specified column, value, and ID.
public
update(string $col, string $val, string $id) : bool
Parameters
- $col : string
-
The column to update the value in.
- $val : string
-
The new value to update the column with.
- $id : string
-
The ID of the record to update.
Return values
bool —Returns true if the record is successfully updated, false otherwise.