tab_tenants_logos
in package
Class tab_tenants_logos
Represents a class for interacting with the tenants_logos table in the database.
Table of Contents
Properties
- $allowedcols : array<string|int, mixed>
- $db : db_master
Methods
- __construct() : void
- Constructor for the class.
- __destruct() : void
- Destructor for the class.
- delete() : bool
- Deletes data from the `tenants_logos` table based on the provided value and column.
- deleteimg() : bool
- Deletes the image file with the provided file name.
- get() : array<string|int, mixed>|bool
- Retrieves data from the `tenants_logos` table based on the provided tenant ID and type.
- insert() : bool|string
- Inserts data into the `tenants_logos` table with the provided tenant ID, type, and filename.
- update() : bool
- Updates the `filename` field in the `tenants_logos` table for a specific tenant and logo type.
- upload() : bool|string
- Uploads a file to the server and returns the file name if successful, otherwise returns false.
Properties
$allowedcols
protected
array<string|int, mixed>
$allowedcols
= ['id', 'tenant', 'type', 'filename']
$db
protected
db_master
$db
The database connection object.
Methods
__construct()
Constructor for the class.
public
__construct() : void
Initializes the object by assigning the global database manager to the "db" property.
__destruct()
Destructor for the class.
public
__destruct() : void
Destroys the object by unsetting the "db" property.
delete()
Deletes data from the `tenants_logos` table based on the provided value and column.
public
delete(string $val[, string $col = 'tenant' ]) : bool
Parameters
- $val : string
-
The value to match in the specified column.
- $col : string = 'tenant'
-
The column to use for matching (optional, default is 'tenant').
Return values
bool —True if the deletion was successful, false otherwise.
deleteimg()
Deletes the image file with the provided file name.
public
deleteimg(string $fname) : bool
Parameters
- $fname : string
-
The name of the image file to delete.
Return values
bool —True if the file was successfully deleted, false otherwise.
get()
Retrieves data from the `tenants_logos` table based on the provided tenant ID and type.
public
get(string $tid, string $type) : array<string|int, mixed>|bool
Parameters
- $tid : string
-
The ID of the tenant.
- $type : string
-
The type of the logo.
Return values
array<string|int, mixed>|bool —The fetched data as an array of rows if successful, false otherwise.
insert()
Inserts data into the `tenants_logos` table with the provided tenant ID, type, and filename.
public
insert(string $tid, string $type, string $filename) : bool|string
Parameters
- $tid : string
-
The ID of the tenant.
- $type : string
-
The type of the logo.
- $filename : string
-
The filename of the logo.
Return values
bool|string —Returns the last inserted ID if successful, false otherwise.
update()
Updates the `filename` field in the `tenants_logos` table for a specific tenant and logo type.
public
update(string $filename, string $tid, string $type) : bool
Parameters
- $filename : string
-
The new filename to be updated.
- $tid : string
-
The ID of the tenant.
- $type : string
-
The type of the logo.
Return values
bool —Returns true if the update was successful, false otherwise.
upload()
Uploads a file to the server and returns the file name if successful, otherwise returns false.
public
upload(string $name, string $type) : bool|string
Parameters
- $name : string
-
The name of the file input field.
- $type : string
-
The type of the logo. Must be either '1' or '2'.
Return values
bool|string —The uploaded file name if successful, false otherwise.