Preview a livewire component with form in a Filament settings page, gives 500 error
Hey guys,
I have a pretty specific question, will try to explain as well as possible. I have a booking widget and a Filament page with the widget settings (1). On the settings page I want to show a preview of the widget (2), this idea I got from the invoice page on https://github.com/andrewdwallo/erpsaas/. In the screenshot below you see a var_dump of the form, more to show that this should be the location of the livewire component.
The problem I am running into is Filament giving a 500 error, and this only happens when the form of the widget is rendered. I think the issue has to do with Filament being confused there are two form variables on the page.
Any ideas on how I can make this work?
Solution:Jump to solution
Update: I have figured it out! I just needed to add a Blade component with
@livewire('booking-widget', ['settings' => $settings])
and render it on the Filament page:
```ViewField::make( 'preview' )
->hiddenLabel()
->view( 'filament.components.preview-booking-widget' ) ->viewData( [
'settings' => $this->settings, ] ),...3 Replies
Solution
Update: I have figured it out! I just needed to add a Blade component with
@livewire('booking-widget', ['settings' => $settings])
and render it on the Filament page: