F
Filament10mo ago
toeknee

SpatieMediaLibrary not uploading files Livewire Component?

Using The interacts with media on the model, and then in the form component we have the standard type of save:
public function save(): void
{
// Validate the form accordingly
$this->form->validate();

$stateData = $this->form->getState();

}
public function save(): void
{
// Validate the form accordingly
$this->form->validate();

$stateData = $this->form->getState();

}
Looking at the network requests we are having files uploaded to upload-file?expires=3423232342332 any suggestions? Using S3 no errors, not logs. Just no files saved, used to work in V2.
Solution:
Double tested, just needed the saveRelationships method added post create.
Jump to solution
8 Replies
toeknee
toekneeOP10mo ago
bumppp
LeandroFerreira
LeandroFerreira10mo ago
did you publish livewire config?
toeknee
toekneeOP10mo ago
There's one published from v2, why so? Noting spatie file uploads work in a filament resource
LeandroFerreira
LeandroFerreira10mo ago
I guess it is different on livewire v3... You could try to publish it again
toeknee
toekneeOP10mo ago
Thanks for the hint, I'll have a further play. They are uploaded as per Livewire v3 to the livewire-tmp dir. So it's something other than that, its how Spatie is handling the save method I suspect. I'll review the Forms V3 docs to see if something changed
LeandroFerreira
LeandroFerreira10mo ago
hum..
toeknee
toekneeOP10mo ago
Got it! Applied the model to the form initation instance, then also after create, ->saveRelationships. Just re-read the docs and relationships etc.
Solution
toeknee
toeknee10mo ago
Double tested, just needed the saveRelationships method added post create.
Want results from more Discord servers?
Add your server