Open Manoz opened 4 years ago
Add a collection with single file.
Like this
public function registerMediaCollections(): void
{
$this->addMediaCollection('image')
->singleFile();
}
You can only add one file but it still display "Add New Media" / "Upload New Media".
Thanks @bcoelhonqda but it doesn't work. Any way to make this work like before and don't add the "Add new media" button for single medias?
Similar problems here. There doesn't seem to be a way to prevent the user from adding more than one file through the media library field.
You can put a validation rule on the field, e.g. ->rules('nullable', 'max:1')
, and that will prevent the form from submitting when multiple files are chosen, however, no validation error is displayed.
@stuartcusackie yeah unfortunately that's more a "workaround" than a real fix :( Btw I've updated all my dependencies to latest versions from spatie and still have the same issue
same issue here
Issue does not happen to me:
spatie/laravel-medialibrary:10.3.2 laravel/framework:9.9.0 laravel/nova:4.2.5
Any update on a fix for this?
Any solution?
Hello,
I'm struggling to make this package work on lastest version of Laravel and Nova. Basically I created a field where users can upload one image but looks like the field still display the button "Add new media" under my image.
Here my field:
Here's my model:
And here's a preview of my field:
Might be related to #117 but the
singleFile()
method doesn't work anymore on Spatie's Laravel medialibrairie v8 :/