PHP Класс Spatie\MediaLibrary\MediaRepository

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$model Media

Открытые методы

Метод Описание
__construct ( Media $model )
all ( ) : Illuminate\Database\Eloquent\Collection Get all media.
getByCollectionName ( string $collectionName ) : Illuminate\Database\Eloquent\Collection * Get all media for the given type and collection name.
getByIds ( array $ids ) : Illuminate\Database\Eloquent\Collection * Get media by ids.
getByModelType ( string $modelType ) : Illuminate\Database\Eloquent\Collection * Get all media for the given type.
getByModelTypeAndCollectionName ( string $modelType, string $collectionName ) : Illuminate\Database\Eloquent\Collection * Get all media for the given type and collection name.
getCollection ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model, string $collectionName, array | callable $filter = [] ) : Collection Get all media in the collection.

Защищенные методы

Метод Описание
applyFilterToMediaCollection ( Collection $media, array | callable $filter ) : Collection Apply given filters on media.
getDefaultFilterFunction ( array $filters ) : Closure Convert the given array to a filter function.
loadMedia ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model, string $collectionName ) : mixed Load media by collectionName.
mediaIsPreloaded ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model ) : boolean * Determine if media is already preloaded on this model.

Описание методов

__construct() публичный Метод

public __construct ( Media $model )
$model Media

all() публичный Метод

Get all media.
public all ( ) : Illuminate\Database\Eloquent\Collection
Результат Illuminate\Database\Eloquent\Collection

applyFilterToMediaCollection() защищенный Метод

Apply given filters on media.
protected applyFilterToMediaCollection ( Collection $media, array | callable $filter ) : Collection
$media Illuminate\Support\Collection
$filter array | callable
Результат Illuminate\Support\Collection

getByCollectionName() публичный Метод

* Get all media for the given type and collection name.
public getByCollectionName ( string $collectionName ) : Illuminate\Database\Eloquent\Collection
$collectionName string
Результат Illuminate\Database\Eloquent\Collection

getByIds() публичный Метод

* Get media by ids.
public getByIds ( array $ids ) : Illuminate\Database\Eloquent\Collection
$ids array
Результат Illuminate\Database\Eloquent\Collection

getByModelType() публичный Метод

* Get all media for the given type.
public getByModelType ( string $modelType ) : Illuminate\Database\Eloquent\Collection
$modelType string
Результат Illuminate\Database\Eloquent\Collection

getByModelTypeAndCollectionName() публичный Метод

* Get all media for the given type and collection name.
public getByModelTypeAndCollectionName ( string $modelType, string $collectionName ) : Illuminate\Database\Eloquent\Collection
$modelType string
$collectionName string
Результат Illuminate\Database\Eloquent\Collection

getCollection() публичный Метод

Get all media in the collection.
public getCollection ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model, string $collectionName, array | callable $filter = [] ) : Collection
$model Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia
$collectionName string
$filter array | callable
Результат Illuminate\Support\Collection

getDefaultFilterFunction() защищенный Метод

Convert the given array to a filter function.
protected getDefaultFilterFunction ( array $filters ) : Closure
$filters array
Результат Closure

loadMedia() защищенный Метод

Load media by collectionName.
protected loadMedia ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model, string $collectionName ) : mixed
$model Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia
$collectionName string
Результат mixed

mediaIsPreloaded() защищенный Метод

* Determine if media is already preloaded on this model.
protected mediaIsPreloaded ( Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia $model ) : boolean
$model Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia
Результат boolean

Описание свойств

$model защищенное свойство

protected Media,Spatie\MediaLibrary $model
Результат Media