Hi everyone,
I'm trying to have a action modal rendered via a panel render hook, but I can't seem to get the action to do anything. Trying multiple YouTube videos/tutorials, it's not even giving me an error, just not doing anything.
Livewire component:
class SwitchHotels extends Component implements HasActions, HasForms
{
use InteractsWithActions;
use InteractsWithForms;
public function renderHotelSwitch()
{
return Action::make('switchHotel')
->label('Switch Hotel')
->icon('heroicon-m-building-office-2')
->form([
Select::make('hotel_id')
->label('Switch Hotel')
->options(function () {
return Hotel::pluck('name', 'id')->toArray();
})
->required()
])
->action(function (array $data): void {
$hotel = Hotel::findOrFail($data['hotel_id']);
auth()->user()->update([
'current_hotel_id' => $hotel->id
]);
$this->redirect(request()->header('Referer'));
});
}
public function render()
{
return view('livewire.switch-hotels');
}
}
And How I render it:
FilamentView::registerRenderHook(PanelsRenderHook::GLOBAL_SEARCH_AFTER, function() {
return Blade::render("<livewire:switch-hotels />");
});
Any help appreciated.