Spatie Media collections are not working in CategoryResource
I've already set to collection name but images are saving default collection like 1/example.jpg like that. Where am I do wrong?
5 Replies
Collections and paths are different things. To change the generated path, you need to create a custom
PathGenerator
https://spatie.be/docs/laravel-medialibrary/v11/advanced-usage/using-a-custom-directory-structureUsing a custom directory structure | laravel-medialibrary
laravel-medialibrary
I do not need like that. I just want to save all images to category folder. That's it. collection() allows to group files. That's not working.
Unless something has changer recently, that's not how collections work - all they do is group media records.
let me check
Thank you
do you have example or sth
It's in the docs. If you want to save to a specific folder, either create a different disk in
filesystems.php
and use that (eg
or do as I said above and use a custom path generator (I don't have an example for that at hand sorry)