How to use SpatieMediaLibraryFileUpload in hintAction?
I Have a hint action to create new record like:
but I only get name in
$data
array, how can I access image?9 Replies
Possible?
It should exist within $data? Otherwise use:
$this->getState
No, it does not exist in $data, the normal FileUpload works and shows file name in $data but not SpatieMediaLibraryFileUpload.
I can't use $this, getting error
Using $this when not in object context
The following works but I don't think this is the best way to do this.
Try it like this:
Tried this, it does nothing. No record is created.
On your
PropertyAmenity
model, have you created a registerMediaCollections()
method to auto-link the files to the model?
Ref: https://spatie.be/docs/laravel-medialibrary/v10/working-with-media-collections/defining-media-collectionsDefining media collections | laravel-medialibrary
laravel-medialibrary
is your hint in a create form?
Oh, you need to create a record?
This works, thanks!