Dumping $data doesn't include the SpatieMediaLibraryFileUpload value.
$data doesn't include the thumbnail from SpatieMediaLibraryFileUpload.
10 Replies
Here's my current code
relationships are not saved in the $data array, you could save them
as discussed here
https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#passing-the-form-model-after-the-form-has-been-submitted
The idea Sir is to get the uploaded file and process it manually.
first attach them to the model the process them
could you give an example of what processing is needed for the images
Technically Sir, the action there is not supposed to save the media yet. I still need to pass the data I get there to the parent component, which is a repeater. The issue is that all the data is being received, except for the uploaded media file — it's missing when I dump dd($this->data).
Its how SpatieMediaLibraray Works
Its a relation based connected to the model which needs to be created to be attached
Using a FileUpload field instead would work with you
add ->dehydrated maybe? but dont forget to unset it before save
if you pass
SpatieMediaLibraryFileUpload::make('thumbnail')->dehydrated()
, I think you can access the TemporaryUploadedFile
in the $data
array.
You can also try saveUploadedFileUsing
using a FileUpload field
By the way, I access the image like this
$actionData = $livewire->mountedFormComponentActionsData[0] ?? [];
not sure if it is a good approach though.no problem, I think