# WHMCS\Download\Download

`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.

## Methods

### asLink

```php
public function asLink()
```

Represent a download as a file download link.

**Returns** `string`

### downloadCategory

```php
public function downloadCategory()
```

A download exists within a category.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsTo`

### products

```php
public function products()
```

A download can be associated with one or more products.

**Returns** `\Illuminate\Database\Eloquent\Relations\BelongsToMany`

### scopeConsiderProductDownloads

```php
public function scopeConsiderProductDownloads(Builder $query)
```

### scopeTopDownloads

```php
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`

### boot

```php
public static function boot()
```

Bind events to download objects.

### translatedNames

```php
public function translatedNames()
```

Return the translated names for the specific download

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]`

### translatedDescriptions

```php
public function translatedDescriptions()
```

Return the translated names for the specific download

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany\|\WHMCS\Language\DynamicTranslation[]`

### scopeInCategory

```php
public function scopeInCategory(Builder $query, $catId)
```

### scopeVisible

```php
public function scopeVisible(Builder $query)
```

Scopes model to return visible downloads only

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### scopeCategoryVisible

```php
public function scopeCategoryVisible(Builder $query)
```

### scopeSearch

```php
public function scopeSearch(Builder $query, $search)
```