And inside the form.elements.blade.php (under /views/admin/operator/components), I added your media-uploader widget, just like it's written in the documentation -
...So...
The first error I'm getting is -
Declaration of App\Models\Operator::registerMediaCollections() must be compatible with Spatie\MediaLibrary\HasMedia::registerMediaCollections(): void ..
Adding the " : void " part inside the model actually helped me to finally upload the view with the media upload widget ..
public function registerMediaCollections() : void {
$this->addMediaCollection('gallery');
}
Resulted in -
But, when I'm trying to hit 'Save', I get the following error -
"Error! Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, string given, called in /Users/gonras/trusted_network/operators-project/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 886"
And unfortunately , I am unable to debug further from this point.
I simply have 1 model that i'd like to be able to upload a logo for it (in this case - it's name is 'Operator') The model itself looks like this -
And the controller's store method looks like this -
Inside /js/admin/operator/Form.js , I added the mediaCollections into the VueJS mixin, like this -
And inside the form.elements.blade.php (under /views/admin/operator/components), I added your media-uploader widget, just like it's written in the documentation -
...So... The first error I'm getting is -
Declaration of App\Models\Operator::registerMediaCollections() must be compatible with Spatie\MediaLibrary\HasMedia::registerMediaCollections(): void
..Adding the " : void " part inside the model actually helped me to finally upload the view with the media upload widget ..
Resulted in -
But, when I'm trying to hit 'Save', I get the following error -
And unfortunately , I am unable to debug further from this point.