Class · extends AbstractModel
A downloadable file.
This object contains information about a specific file made available for download.
All Downloads belong to one or more Download\Categories. The number of times this file has been downloaded is tracked by timesDownloaded, a value incremented upon download.
The location on the filesystem for this specific download is stored here as well.
Each download file can be flagged as a Product Download (upon which a Client must have an instance of the related Product as a Service in order to download the file), as available only to Clients to be downloaded, or flagged as "hidden."
A hidden file is never provided in the client's user interface for download, in any category, hidden or otherwise.
public function asLink()Represent a download as a file download link.
Returns string
public function downloadCategory()A download exists within a category.
Returns \Illuminate\Database\Eloquent\Relations\BelongsTo
public function products()A download can be associated with one or more products.
Returns \Illuminate\Database\Eloquent\Relations\BelongsToMany
public function scopeConsiderProductDownloads(Builder $query)public function scopeTopDownloads(Builder $query, $count = 5)Look for "top" downloads.
Top downloads are the most downloaded downloads that are not hidden and belong to a non-hidden category.
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query | |
int | $count |
Returns Builder
public static function boot()Bind events to download objects.
public function translatedNames()Return the translated names for the specific download
Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]
public function translatedDescriptions()Return the translated names for the specific download
Returns \Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]
public function scopeInCategory(Builder $query, $catId)public function scopeVisible(Builder $query)Scopes model to return visible downloads only
Parameters
| Type | Name | Description |
|---|---|---|
Builder | $query |
Returns Builder
public function scopeCategoryVisible(Builder $query)public function scopeSearch(Builder $query, $search)