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:
Removing the manual entry for Alpine.start() in resources/js/app.js fixed the issue.
Jump to solution
15 Replies
krekas
krekas2y ago
Console errors?
Ehsan
EhsanOP2y ago
There are no console errors.
Ehsan
EhsanOP2y ago
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.
Ehsan
EhsanOP2y ago
Same is happening with basic FileUpload component
Ehsan
EhsanOP2y ago
This is how it looks on backend
krekas
krekas2y ago
I guess you are missing some styles or scripts. I think there's @filamentScripts and @FilamentStyles
Ehsan
EhsanOP2y ago
This is the layout view. Everything is included.
Ehsan
EhsanOP2y ago
Now I am getting an error Alpine Expression Error: $wire is not defined on file component
krekas
krekas2y ago
the 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
krekas2y ago
Ehsan
EhsanOP2y ago
@krekas This one is on admin panel side, not the livewire form component
krekas
krekas2y ago
In my screenshot it is not
Ehsan
EhsanOP2y ago
Can you please share the component view file and the layout on how you have implemented it.
krekas
krekas2y ago
just go through the docs how to install everything in the existhing app
Solution
Ehsan
Ehsan2y ago
Removing the manual entry for Alpine.start() in resources/js/app.js fixed the issue.

Did you find this page helpful?