PHP 클래스 Spatie\MediaLibrary\MediaRepository

파일 보기 프로젝트 열기: spatie/laravel-medialibrary 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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