Spatie Media Library plugin not working in livewire form component
I am trying to create a livewire form component using Filament v3 by following https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component
I am trying to add a Spatie Media Library field to the form
SpatieMediaLibraryFileUpload::make('photo')
and shows normal file upload field which fails validation on submit (Probably because of changes to file field by Spatie plugin).
On the admin panel, it is working fine and shows filepod snippet.
I am using app
layout of Filament v3 with all Filament styles & scripts injected.Solution:Jump to solution
Removing the manual entry for
Alpine.start()
in resources/js/app.js
fixed the issue.15 Replies
Console errors?
There are no console errors.
This is how the component is rendered on page without any errors, but no requests are triggered to backend when the file is uploaded. Also the basic required validation fails on this file upload.
Same is happening with basic
FileUpload
componentThis is how it looks on backend
I guess you are missing some styles or scripts. I think there's
@filamentScripts
and @FilamentStyles
This is the layout view. Everything is included.
Now I am getting an error
Alpine Expression Error: $wire is not defined
on file componentthe way you use alpine i guess is wrong
because i can see filepond correctly in a livewire component which isn't in the panel
@krekas This one is on admin panel side, not the livewire form component
In my screenshot it is not
Can you please share the component view file and the layout on how you have implemented it.
just go through the docs how to install everything in the existhing app
Solution
Removing the manual entry for
Alpine.start()
in resources/js/app.js
fixed the issue.