PHP Interface Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia

ファイルを表示 Open project: spatie/laravel-medialibrary

Public Methods

Method Description
addMedia ( string | Symfony\Component\HttpFoundation\File\UploadedFile $file ) : FileAdder Move a file to the medialibrary.
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.
getMedia ( string $collectionName = 'default', array | callable $filters = [] ) : Media Get media collection by its collectionName.
hasMedia ( string $collectionMedia = '' ) : 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.

Method Details

addMedia() public method

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

clearMediaCollection() public method

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

copyMedia() public method

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

getMedia() public method

Get media collection by its collectionName.
public getMedia ( string $collectionName = 'default', array | callable $filters = [] ) : Media
$collectionName string
$filters array | callable
return Spatie\MediaLibrary\Media

hasMedia() public method

Determine if there is media in the given collection.
public hasMedia ( string $collectionMedia = '' ) : boolean
$collectionMedia string
return boolean

media() public method

Set the polymorphic relation.
public media ( ) : mixed
return mixed

shouldDeletePreservingMedia() public method

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