A download category

All files available for download in WHMCS must be within at least one Category. Files may exist within multiple Categories. Categories may also contain other Categories. If a Category is hidden, all files within that Category will be hidden throughout the user interface (even those files exist in visible categories).

class Category extends AbstractModel

Properties summary

Type Property Description
protected $table
protected $columnMap
protected $booleans
int $id Unique ID number for this category.
int $parentId If this category is a sub-category, this is the unique ID number of it's parent.
string $name Name of this category.
string $description A textual description of the contents of this category.
bool $isHidden If true, do not display this category to clients.
Carbon $createdAt The date this category was created.
Carbon $updatedAt The date this category was first updated.
Category $parentCategory Category object of this category's parent, if this is a subcategory.
Category[] $childCategories Array of Category objects which are subcategories of this one, if they exist.
Download[] $downloads Array of Download objects which belong in this category.

Methods summary

Return Type Method Name Description
HasOne parentCategory() A category may have a parent category.
HasMany childCategories() A category may have many child categories.
HasMany downloads() A download category may have many downloads in it.
Builder scopeOfParent(Builder $query, int $parentId) Scopes model for children categories for $parentId
Builder scopeVisible(Builder $query) Scopes model to return visible categories only

Details

HasOne parentCategory ()

A category may have a parent category.

Return Value

HasOne

HasMany childCategories ()

A category may have many child categories.

Return Value

HasMany

HasMany downloads ()

A download category may have many downloads in it.

Return Value

HasMany

Builder scopeOfParent (Builder $query, int $parentId)

Scopes model for children categories for $parentId

Parameters

Builder $query
int $parentId

Return Value

Builder

Builder scopeVisible (Builder $query)

Scopes model to return visible categories only

Parameters

Builder $query

Return Value

Builder