HasMedia
trait HasMedia
Properties
protected array | $unAttachedMediaItems |
Methods
No description
Set the polymorphic relation.
Query scope to detect the presence of one or more attached media for a given tag.
No description
No description
No description
No description
Get the thumbnail of the first media item of a default tag.
Get a collection of media attachments by its tag.
Get the first media item of a media tag.
No description
Lazy eager load attached media relationships.
Determine if the specified tag contains media.
Replace the existing media collection for the specified tag(s).
Detach a media item from the model.
Delete all media with the given tag except some.
Remove all media with the given tag.
No description
No description
No description
Delete media relationships when the model is deleted. Ignore on soft deletes.
Convert the given array to a filter closure.
Get all of the IDs from the given mixed value.
Details
at line 20
static
bootHasMedia()
No description
at line 32
mixed
media()
Set the polymorphic relation.
at line 43
void
scopeWhereHasMedia(Builder $query, string|string[] $tags)
Query scope to detect the presence of one or more attached media for a given tag.
at line 53
newMediaInstance()
No description
at line 61
getAttribute($key)
No description
at line 75
setAttribute($key, $value)
No description
at line 84
getDefaultTagName()
No description
at line 100
string
getThumb(array $options = [], string $tag = null)
Get the thumbnail of the first media item of a default tag.
at line 113
Collection
getMedia(string $tag = null, array|callable $filters = [])
Get a collection of media attachments by its tag.
at line 131
Media|null
getFirstMedia(string $tag = null, array $filters = [])
Get the first media item of a media tag.
at line 136
findMedia($mediaId)
No description
at line 154
Collection
loadMedia($tag)
Lazy eager load attached media relationships.
at line 172
bool
hasMedia(string $tag = null)
Determine if the specified tag contains media.
at line 185
Collection
syncMedia(mixed $media, string $tag = null)
Replace the existing media collection for the specified tag(s).
at line 211
void
deleteMedia(mixed $mediaId)
Detach a media item from the model.
at line 228
protected
deleteMediaExcept(mixed $media, string $tag = null)
Delete all media with the given tag except some.
at line 244
void
clearMediaTag(string $tag = null)
Remove all media with the given tag.
at line 254
prepareUnattachedMedia(Media $media, MediaAdder $mediaAdder)
No description
at line 259
processUnattachedMedia(callable $callable)
No description
at line 268
mediable()
No description
at line 284
protected
mediaWasLoaded()
No description
at line 293
protected void
handleHasMediaDeletion()
Delete media relationships when the model is deleted. Ignore on soft deletes.
at line 307
protected Closure
buildMediaPropertiesFilter(array $filters)
Convert the given array to a filter closure.
at line 328
protected array
parseIds(mixed $value)
Get all of the IDs from the given mixed value.