BaseModel
class BaseModel implements ModelInterface
A base database object (e.g. A player or a team)
Constants
TABLE |
The name of the database table used for queries You can use this constant in static methods as such: static::TABLE |
Methods
Update a database field
Delete the object
Permanently delete the object from the database
Get an object's database ID
See if an object is valid
Get the MySQL columns that will be loaded as soon as the model is created
Gets an entity from the supplied slug, which can either be an alias or an ID
Details
at line line 132
void
update(string $name, mixed $value)
Update a database field
at line line 144
void
delete()
Delete the object
Please note that this does not delete the object entirely from the database, it only hides it from users. You should overload this function if your object does not have a 'status' column which can be set to 'deleted'.
at line line 153
void
wipe()
Permanently delete the object from the database
at line line 162
int
getId()
Get an object's database ID
at line line 171
bool
isValid()
See if an object is valid
at line line 318
static string
getEagerColumns()
Get the MySQL columns that will be loaded as soon as the model is created
at line line 384
static Model
fetchFromSlug(string|int $slug)
Gets an entity from the supplied slug, which can either be an alias or an ID
at line line 436
BaseModel
refresh()
Fetch a model's data from the database again
at line line 460
static Model
invalid()
Generate an invalid object
<?php
$object = Team::invalid();
get_class($object); // Team
$object->isValid(); // false