PHP Class Spatie\MediaLibrary\Media

Inheritance: extends Illuminate\Database\Eloquent\Model, use trait SortableTrait
Show file Open project: spatie/laravel-medialibrary Class Usage Examples

Protected Properties

Property Type Description
$casts array The attributes that should be casted to native types.
$guarded

Public Methods

Method Description
getCustomProperty ( string $propertyName, mixed $default = null ) : mixed Get if the value of custom property with the given name.
getDiskDriverName ( ) : string
getExtensionAttribute ( ) : string
getHumanReadableSizeAttribute ( ) : string
getImageGenerators ( ) : Collection Collection of all ImageGenerator drivers.
getMediaConversionNames ( ) : array * Get all the names of the registered media conversions.
getMimeAttribute ( ) : string
getPath ( string $conversionName = '' ) : string Get the original path to a media-file.
getTypeAttribute ( ) : string Determine the type of a file.
getTypeFromExtensionAttribute ( ) : string Determine the type of a file from its file extension.
getTypeFromMimeAttribute ( ) : string * Determine the type of a file from its mime type
getUrl ( string $conversionName = '' ) : string Get the original Url to a media-file.
hasCustomProperty ( string $propertyName ) : boolean * Determine if the media item has a custom property with the given name.
model ( ) : Illuminate\Database\Eloquent\Relations\MorphTo Create the polymorphic relation.
removeCustomProperty ( string $name )
setCustomProperty ( string $name, mixed $value )

Method Details

getCustomProperty() public method

Get if the value of custom property with the given name.
public getCustomProperty ( string $propertyName, mixed $default = null ) : mixed
$propertyName string
$default mixed
return mixed

getDiskDriverName() public method

public getDiskDriverName ( ) : string
return string

getExtensionAttribute() public method

public getExtensionAttribute ( ) : string
return string

getHumanReadableSizeAttribute() public method

getImageGenerators() public method

Collection of all ImageGenerator drivers.
public getImageGenerators ( ) : Collection
return Illuminate\Support\Collection

getMediaConversionNames() public method

* Get all the names of the registered media conversions.
public getMediaConversionNames ( ) : array
return array

getMimeAttribute() public method

public getMimeAttribute ( ) : string
return string

getPath() public method

Get the original path to a media-file.
public getPath ( string $conversionName = '' ) : string
$conversionName string
return string

getTypeAttribute() public method

Determine the type of a file.
public getTypeAttribute ( ) : string
return string

getTypeFromExtensionAttribute() public method

Determine the type of a file from its file extension.

getTypeFromMimeAttribute() public method

* Determine the type of a file from its mime type
public getTypeFromMimeAttribute ( ) : string
return string

getUrl() public method

Get the original Url to a media-file.
public getUrl ( string $conversionName = '' ) : string
$conversionName string
return string

hasCustomProperty() public method

* Determine if the media item has a custom property with the given name.
public hasCustomProperty ( string $propertyName ) : boolean
$propertyName string
return boolean

model() public method

Create the polymorphic relation.
public model ( ) : Illuminate\Database\Eloquent\Relations\MorphTo
return Illuminate\Database\Eloquent\Relations\MorphTo

removeCustomProperty() public method

public removeCustomProperty ( string $name )
$name string

setCustomProperty() public method

public setCustomProperty ( string $name, mixed $value )
$name string
$value mixed

Property Details

$casts protected property

The attributes that should be casted to native types.
protected array $casts
return array

$guarded protected property

protected $guarded