Download the PHP package elegantly/filament-media-plugin without Composer
On this page you can find all versions of the php package elegantly/filament-media-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elegantly/filament-media-plugin
More information about elegantly/filament-media-plugin
Files in elegantly/filament-media-plugin
Package filament-media-plugin
Short Description Filament support for `elegantly/laravel-media`.
License MIT
Homepage https://github.com/ElegantEngineeringTech/filament-laravel-media
Informations about the package filament-media-plugin
Filament Elegantly Media Plugin
Installation
Install the plugin with Composer:
If you haven't already done so, you need to publish the migration to create the media table:
Run the migrations:
You must also prepare your Eloquent model for attaching media.
For more information, check out the documentation.
Form component
You may use the field in the same way as the original file upload field:
The media file upload supports all the customization options of the original file upload component.
Passing a collection
Optionally, you may pass a collection()
allows you to group files into categories:
Configuring the storage disk and directory
By default, files will be uploaded publicly to your storage disk defined in the collection.
Alternatively, you can manually set the disk with the disk()
method:
Reordering files
In addition to the behavior of the normal file upload, Elegantly's Media also allows users to reorder files.
To enable this behavior, use the reorderable()
method:
You may now drag and drop files into order.
Adding metadata
You may pass in [metadata] when uploading files using the metadata()
method:
Using conversions
You may also specify a conversion()
to load the file from showing it in the form, if present:
Filtering media
It's possible to target a file upload component to only handle a certain subset of media in a collection. To do that, you can filter the media collection using the filterMediaUsing()
method. This method accepts a function that receives the $media
collection and manipulates it. You can use any collection method to filter it.
For example, you could scope the field to only handle media that has certain custom properties:
Using media for rich editor file attachments
You can use media to store file attachments in the rich editor. To do this, you must register a rich content attribute on your model, similar to how a media library collection is registered. You should call fileAttachmentProvider()
on the attribute registration, passing in a ElegantlyMediaFileAttachmentProvider::make()
object:
A media collection with the same name as the attribute (content
in this example) will be used for the file attachments. The collection must not contain any other media apart from file attachments for that attribute, since Filament will clear any unused media from the collection when the model is saved. To customize the name of the collection, you can pass it to the collection()
method of the provider:
Table column
To use the media library image column:
The media library image column supports all the customization options of the original image column.
Passing a collection
Optionally, you may pass a collection()
:
By default, only media without a collection (using the default
collection) will be shown. If you want to show media from all collections, you can use the allCollections()
method:
Using conversions
You may also specify a conversion()
to load the file from showing it in the table, if present:
Filtering media
It's possible to target the column to only display a subset of media in a collection. To do that, you can filter the media collection using the filterMediaUsing()
method. This method accepts a function that receives the $media
collection and manipulates it. You can use any collection method to filter it.
For example, you could scope the column to only display media that has certain custom properties:
Infolist entry
To use the media library image entry:
The media library image entry supports all the customization options of the original image entry.
Passing a collection
Optionally, you may pass a collection()
:
By default, only media without a collection (using the default
collection) will be shown. If you want to show media from all collections, you can use the allCollections()
method:
Using conversions
You may also specify a conversion()
to load the file from showing it in the infolist, if present:
Filtering media
It's possible to target the entry to only display a subset of media in a collection. To do that, you can filter the media collection using the filterMediaUsing()
method. This method accepts a function that receives the $media
collection and manipulates it. You can use any collection method to filter it.
For example, you could scope the entry to only display media that has certain custom properties:
All versions of filament-media-plugin with dependencies
filament/support Version self.version
elegantly/laravel-media Version ^4.0