share-lt/docs/decisions/004-spatie-media-library.md

25 lines
1.7 KiB
Markdown
Raw Normal View History

# 2026-01-02
```bash
php artisan storage:link
composer require "spatie/laravel-medialibrary"
composer require filament/spatie-laravel-media-library-plugin:"^4.0" -W
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-config"
php artisan migrate
```
I had a lot of fun and silly games working out if I even needed both Spatie media library and the filament plugin they have as it states itself a sub directory of filament itself.
I managed to remove the spatie fulament plugin and for the app to work for a while but eventually found a part of it not implemented in filament core. It took a while but there seems to be an overlap somewhere. So I re-installed the spatie filament module to find all the errors went away, when previously they did not
PHP and I guess composer would seem to aggressively cache things very very hard and I just didnt understand how very hard that is sometimes.
Suffice to say, spatie media library seems to be 'the way' as far as media is concerned for filament.
I looked at curator, also by the author of the tiptap filament integration to find it seems dependant on tailwind3, limiting me to Laravel 11 I believe, which was not what I wanted.
I used filament 'actions' in order to augment the form for 'entries' so as to add 'pick from gallery' functionality together with custom javascript to insert records found in media library for both rich content and featured images
There may be a better way of doing this but for now, I believe this is a solution I have craved for a while now with filament and have at least gained a bit better understanding of so called 'actions' and will re-visit this whole section in the docs.