Getting started
Library
Components
Integrations
Spatie Tags
The Media Library integrates with spatie/laravel-tags to let you tag media items directly from the file info panel. The integration is automatic – if the package is installed and you are using the Media Library Item Driver, no extra configuration is required.
You get two things out of the box:
- A tags input in the file info panel, letting you add or remove tags on the selected item.
- A tags filter in the Media Library, letting you filter items by one or more tags.
Disabling the integration
If you have spatie/laravel-tags installed but do not want the integration active, pass false to ->spatieTagsIntegration():
$plugin->spatieTagsIntegration(false)
Scoping available tags
By default the integration surfaces every tag in your database. If your app uses multiple tag types, you can restrict the Media Library to a specific type using the modifyQueryUsing closure:
use Illuminate\Database\Eloquent\Builder;
$plugin->spatieTagsIntegration(
modifyQueryUsing: fn (Builder $query) => $query->where('type', 'media'),
)
The closure receives the Eloquent Builder for the tag model and is applied both to the suggestions shown in the file info tags input and to the filter in the Media Library.