PHP 트레잇 Spatie\MediaLibrary\HasMedia\HasMediaTrait

파일 보기 프로젝트 열기: spatie/laravel-medialibrary

공개 프로퍼티들

프로퍼티 타입 설명
$mediaConversions array

보호된 프로퍼티들

프로퍼티 타입 설명
$deletePreservingMedia boolean

공개 메소드들

메소드 설명
addMedia ( string | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : FileAdder Add a file to the medialibrary.
addMediaConversion ( string $name ) : Conversion * Add a conversion.
addMediaFromRequest ( string $key ) : FileAdder Add a file from a request.
addMediaFromUrl ( string $url ) : FileAdder Add a remote file to the medialibrary.
bootHasMediaTrait ( )
clearMediaCollection ( string $collectionName = 'default' ) Remove all media in the given collection.
copyMedia ( string | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : FileAdder Copy a file to the medialibrary.
deleteMedia ( integer | Media $mediaId ) Delete the associated media with the given id.
deletePreservingMedia ( ) : boolean Delete the model, but preserve all the associated media.
getFirstMedia ( string $collectionName = 'default', array $filters = [] ) : Media | null Get the first media item of a media collection.
getFirstMediaPath ( string $collectionName = 'default', string $conversionName = '' ) : string * Get the url of the image for the given conversionName for first media for the given collectionName.
getFirstMediaUrl ( string $collectionName = 'default', string $conversionName = '' ) : string * Get the url of the image for the given conversionName for first media for the given collectionName.
getMedia ( string $collectionName = '', $filters = [] ) : Collection * Get media collection by its collectionName.
hasMedia ( string $collectionName = '' ) : boolean * Determine if there is media in the given collection.
media ( ) : mixed Set the polymorphic relation.
shouldDeletePreservingMedia ( ) : Media Determines if the media files should be preserved when the media object gets deleted.
updateMedia ( array $newMediaArray, string $collectionName = 'default' ) : array Update a media collection by deleting and inserting again with new values.

보호된 메소드들

메소드 설명
removeMediaItemsNotPresentInArray ( array $newMediaArray, string $collectionName = 'default' )

메소드 상세

addMedia() 공개 메소드

Add a file to the medialibrary.
public addMedia ( string | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : FileAdder
$file string | Symfony\Component\HttpFoundation\File\UploadedFile
리턴 Spatie\MediaLibrary\FileAdder\FileAdder

addMediaConversion() 공개 메소드

* Add a conversion.
public addMediaConversion ( string $name ) : Conversion
$name string
리턴 Spatie\MediaLibrary\Conversion\Conversion

addMediaFromRequest() 공개 메소드

Add a file from a request.
public addMediaFromRequest ( string $key ) : FileAdder
$key string
리턴 Spatie\MediaLibrary\FileAdder\FileAdder

addMediaFromUrl() 공개 메소드

Add a remote file to the medialibrary.
public addMediaFromUrl ( string $url ) : FileAdder
$url string
리턴 Spatie\MediaLibrary\FileAdder\FileAdder

bootHasMediaTrait() 공개 정적인 메소드

public static bootHasMediaTrait ( )

clearMediaCollection() 공개 메소드

Remove all media in the given collection.
public clearMediaCollection ( string $collectionName = 'default' )
$collectionName string

copyMedia() 공개 메소드

Copy a file to the medialibrary.
public copyMedia ( string | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : FileAdder
$file string | Symfony\Component\HttpFoundation\File\UploadedFile
리턴 Spatie\MediaLibrary\FileAdder\FileAdder

deleteMedia() 공개 메소드

You may also pass a media object.
public deleteMedia ( integer | Media $mediaId )
$mediaId integer | Spatie\MediaLibrary\Media

deletePreservingMedia() 공개 메소드

Delete the model, but preserve all the associated media.
public deletePreservingMedia ( ) : boolean
리턴 boolean

getFirstMedia() 공개 메소드

Get the first media item of a media collection.
public getFirstMedia ( string $collectionName = 'default', array $filters = [] ) : Media | null
$collectionName string
$filters array
리턴 Spatie\MediaLibrary\Media | null

getFirstMediaPath() 공개 메소드

If no profile is given, return the source's url.
public getFirstMediaPath ( string $collectionName = 'default', string $conversionName = '' ) : string
$collectionName string
$conversionName string
리턴 string

getFirstMediaUrl() 공개 메소드

If no profile is given, return the source's url.
public getFirstMediaUrl ( string $collectionName = 'default', string $conversionName = '' ) : string
$collectionName string
$conversionName string
리턴 string

getMedia() 공개 메소드

* Get media collection by its collectionName.
public getMedia ( string $collectionName = '', $filters = [] ) : Collection
$collectionName string
$filters
리턴 Illuminate\Support\Collection

hasMedia() 공개 메소드

* Determine if there is media in the given collection.
public hasMedia ( string $collectionName = '' ) : boolean
$collectionName string
리턴 boolean

media() 공개 메소드

Set the polymorphic relation.
public media ( ) : mixed
리턴 mixed

removeMediaItemsNotPresentInArray() 보호된 메소드

protected removeMediaItemsNotPresentInArray ( array $newMediaArray, string $collectionName = 'default' )
$newMediaArray array
$collectionName string

shouldDeletePreservingMedia() 공개 메소드

Determines if the media files should be preserved when the media object gets deleted.
public shouldDeletePreservingMedia ( ) : Media
리턴 Spatie\MediaLibrary\Media

updateMedia() 공개 메소드

Update a media collection by deleting and inserting again with new values.
public updateMedia ( array $newMediaArray, string $collectionName = 'default' ) : array
$newMediaArray array
$collectionName string
리턴 array

프로퍼티 상세

$deletePreservingMedia 보호되어 있는 프로퍼티

protected bool $deletePreservingMedia
리턴 boolean

$mediaConversions 공개적으로 프로퍼티

public array $mediaConversions
리턴 array