Метод | Описание | |
---|---|---|
attachMedia ( mixed $media, string | array $tags ) : void | Attach a media entity to the model with one or more tags. | |
bootMediable ( ) : void | Boot the Mediable trait. | |
detachMedia ( mixed $media, string | array | null $tags = null ) : void | Detach a media item from the model. | |
detachMediaTags ( string | array $tags ) : void | Remove one or more tags from the model, detaching any media using those tags. | |
firstMedia ( string | array $tags, boolean $match_all = false ) : boolean | Shorthand for retrieving a single attached media. | |
getAllMediaByTag ( ) : |
Retrieve all media grouped by tag name. | |
getMedia ( string | array $tags, boolean $match_all = false ) : boolean | Retrieve media attached to the model. | |
getMediaMatchAll ( array $tags ) : boolean | Retrieve media attached to multiple tags simultaneously. | |
getTagsForMedia ( |
Get a list of all tags that the media is attached to. | |
hasMedia ( string | array $tags, boolean $match_all = false ) : boolean | Check if the model has any media attached to one or more tags. | |
load ( $relations ) | ||
loadMedia ( string | array $tags = [], boolean $match_all = false ) | Lazy eager load attached media relationships. | |
loadMediaMatchAll ( string | array $tags = [] ) | Lazy eager load attached media relationships matching all provided tags. | |
media ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany | Relationship for all attached media. | |
newCollection ( array $models = [] ) : Plank\Mediable\MediableCollection | ||
scopeWhereHasMedia ( |
Query scope to detect the presence of one or more attached media for a given tag. | |
scopeWhereHasMediaMatchAll ( |
Query scope to detect the presence of one or more attached media that is bound to all of the specified tags simultaneously. | |
scopeWithMedia ( |
Query scope to eager load attached media. | |
scopeWithMediaMatchAll ( |
Query scope to eager load attached media assigned to multiple tags. | |
syncMedia ( mixed $media, string | array $tags ) : void | Replace the existing media collection for the specified tag(s). |
Метод | Описание | |
---|---|---|
addMatchAllToEagerLoadQuery ( Illuminate\Database\Eloquent\Relations\MorphToMany $q, array | string $tags = [] ) : void | Modify an eager load query to only load media assigned to all provided tags simultaneously. | |
handleMediableDeletion ( ) : void | Determine whether media relationships should be detached when the model is deleted or soft deleted. | |
markMediaDirty ( string | array $tags ) : void | Indicate that the media attached to the provided tags has been modified. | |
mediaIsDirty ( null | string | array $tags = null ) : boolean | Check if media attached to the specified tags has been modified. | |
newMatchAllQuery ( array | string $tags = [] ) : [type] | Generate a query builder for. | |
rehydrateMediaIfNecessary ( null | string | array $tags = null ) : void | Reloads media relationship if allowed and necessary. | |
rehydratesMedia ( ) : boolean | Check whether the model is allowed to automatically reload media relationship. |
Метод | Описание | |
---|---|---|
extractIds ( mixed $input ) : array | Convert mixed input to array of ids. | |
getOrderValueForTags ( string | array $tags ) : integer | Determine the highest order value assigned to each provided tag. |
public static bootMediable ( ) : void | ||
Результат | void |
public getAllMediaByTag ( ) : |
||
Результат |
public getMediaMatchAll ( array $tags ) : boolean | ||
$tags | array | |
Результат | boolean |
public getTagsForMedia ( |
||
$media | ||
Результат | array |
protected handleMediableDeletion ( ) : void | ||
Результат | void |
public hasMedia ( string | array $tags, boolean $match_all = false ) : boolean | ||
$tags | string | array | |
$match_all | boolean | If false, will return true if the model has any attach media for any of the provided tags If true, will return true is the model has any media that are attached to all of provided tags simultaneously |
Результат | boolean |
public loadMediaMatchAll ( string | array $tags = [] ) | ||
$tags | string | array | one or more tags |
public media ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany | ||
Результат | Illuminate\Database\Eloquent\Relations\MorphToMany |
public newCollection ( array $models = [] ) : Plank\Mediable\MediableCollection | ||
$models | array | |
Результат | Plank\Mediable\MediableCollection |
protected newMatchAllQuery ( array | string $tags = [] ) : [type] | ||
$tags | array | string | [description] |
Результат | [type] |
protected rehydratesMedia ( ) : boolean | ||
Результат | boolean |
public scopeWhereHasMediaMatchAll ( |
||
$q | ||
$tags | array | |
Результат | void |
public scopeWithMedia ( |
||
$q | ||
$tags | string | array | If one or more tags are specified, only media attached to those tags will be loaded. |
$match_all | boolean | Only load media matching all provided tags |
Результат | void |