Reseller
class
Reseller extends AttributedModel
Reseller model.
Properties
integer $id
ModelRelations $relations
static array $features
string $application_domain
string $application_name
string $application_color
string $application_logo
string $application_favicon
string $application_touchicon
string $application_description
string $application_keywords
string $application_ga_code
string $application_homepage
string $billing_plan
string $xero_id
string $api_endpoint
Methods
boolean
get_from_domain(string $source)
Get a reseller based on the domain name used.
Application
patch_application(Application $application)
Update an Application instance based on the data of this reseller, like logo, favicon and Google Analytics tracking code.
string
get_api_endpoint()
Get the preferred API base URL for Communities in this Reseller account.
Community[]
communities(boolean $include_suspended = false)
Returns an array of Community instances that are part of this Reseller account.
boolean
owns_community(integer|Community $cid)
Check whether a community with this ID belongs to this Reseller account.
stdClass[]
recipes()
Returns a list of saved community recipes for this Reseller account.
boolean|mixed
recipe_add(Community|integer $community, string $title, array $features = [])
Create a new recipe from a certain community to save as part of this Reseller account.
stdClass|null
recipe_get(integer $id)
Get a recipe with a specific ID belonging to this Reseller account.
boolean|mixed
recipe_remove(integer $id)
Remove a recipe with a specific ID belonging ot this Reseller account.
Inherited from Fillable
static boolean|Fillable
create($fields)
Insert a new entry into the model's database table.
Inherited from Model
__construct(mixed $source = null, boolean $disable_global = false)
Model constructor. Pass in an ID (numeric) or object to start the model.
static Model[]
getAll(integer $limit = null)
Get array of all table rows as model instances.
static integer
getCount(array|string $where = null)
Get the number of items in the model that match the query.
static Model|null
find(integer $id)
Get the item of this model with the given ID if it exists. Returns null otherwise.
Note that any value passed to this function is converted into an integer!
static Model|null
findWith(string|array $field, mixed $value = null)
Check if an item with a given field value (exact match) exists.
static Model|null
getBy(string|array $field, mixed $value = null)
Get item by a specific field (exact match). Returns null on failure.
static Model[]
getManyBy(string|array $field, mixed $value = null)
Get array of items that have a specific field value (exact match).
static boolean
exists(integer $id)
Check if an item with a given ID exists.
static boolean
existsWith(string $field, mixed $value = null)
Check if an item with a given field value (exact match) exists.
boolean
update(string|array $field, mixed $value = null)
Update a field of this entry.
boolean
del()
Delete the resource from the database.
object
barebones()
Get a bare bones version of the Model (without db, relations, etc.).
Inherited from AttributedModel
mixed
attr(string $key, null $value = null)
Get or set a value on the model object.
mixed
val(string $key, null $value = null)
Get or set a value on the model object. Alias for attr()
.
array
attributes()
Get all metadata values for a model object.
array
vals()
Get all metadata values for a model object. Alias for attributes()
.
static mixed|null
getAttribute(string $type, integer $modelId, string $attributeKey, null $scope = null, boolean $cache = true)
Static function to get a parameter without having to retrieve the base model.
boolean
is(string $key)
Convenience method for testing if a model value is truthy (bool true, string 'true', int 1, string '1').
Inherited from HasPrivateDatabase
array
getDatabaseCredentials()
Get an array containing keys database
, hostname
, username
, password
, which can be used to
create a connection to the private database from a module.
DB
getDatabase()
Get a database instance that is connected to the model-specific private database.