main
in package
Class main
This class provides methods to interact with the search table in the database.
Table of Contents
Properties
Methods
- __construct() : void
- Initializes a new instance of the class.
- __destruct() : mixed
- Destructor method for the class.
- all() : array<string|int, mixed>|bool
- Retrieves all data from the tsearch object.
- allactives() : array<string|int, mixed>|bool
- Retrieves all active tenants, which are enabled for global search
- delete() : bool
- Deletes a record from the database using the specified value and column.
- get() : array<string|int, mixed>|bool
- Retrieves data from the tsearch object based on a specific value.
- insert() : bool
- Inserts a new record in the search table.
- update() : bool
- Updates a record in the search table.
- updatespost() : bool
- Updates the posts based on the given post data.
Properties
$tsearch
protected
tab_search
$tsearch
The search term to be used for searching
Methods
__construct()
Initializes a new instance of the class.
public
__construct() : void
The constructor creates a new instance of the class and assigns it to the $tsearch
property.
__destruct()
Destructor method for the class.
public
__destruct() : mixed
Unsets the tsearch object.
all()
Retrieves all data from the tsearch object.
public
all([string $sort = 'id' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'id'
-
(optional) The field to sort the data by. Default is 'id'.
- $order : string = 'ASC'
-
(optional) The sort order. Default is 'ASC'.
Return values
array<string|int, mixed>|bool —Returns an array of data if successful, or boolean false if unsuccessful.
allactives()
Retrieves all active tenants, which are enabled for global search
public
allactives() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool —Returns an array of active tenants if successful, or boolean false if unsuccessful.
delete()
Deletes a record from the database using the specified value and column.
public
delete(string $val[, string $col = 'id' ]) : bool
Parameters
- $val : string
-
The value used to determine which record to delete.
- $col : string = 'id'
-
The column in which the value will be searched. (default: 'id')
Return values
bool —Returns true if the record is successfully deleted, false otherwise.
get()
Retrieves data from the tsearch object based on a specific value.
public
get(string $val[, string $col = 'tenant' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for.
- $col : string = 'tenant'
-
(optional) The column to search in. Default is 'tenant'.
Return values
array<string|int, mixed>|bool —Returns an array of data if successful, or boolean false if unsuccessful.
insert()
Inserts a new record in the search table.
public
insert(string $tenant, string $active) : bool
Parameters
- $tenant : string
-
The tenant name for the record.
- $active : string
-
The active status for the record.
Return values
bool —Indicates whether the insertion was successful or not.
update()
Updates a record in the search table.
public
update(string $tenant, string $active) : bool
Parameters
- $tenant : string
-
The tenant name for the record.
- $active : string
-
The new active status for the record.
Return values
bool —Indicates whether the update was successful or not.
updatespost()
Updates the posts based on the given post data.
public
updatespost(array<string|int, mixed> $post) : bool
Parameters
- $post : array<string|int, mixed>
-
The post data containing the information to update.
Return values
bool —Returns true if the update is successful, false otherwise.