Open a Modal when user logs in

Hello. I have a custom livewire component modal that i want to show every time a user logs in on the dashboard page but I cant figure out how to dispatch the event to trigger the opening of thew modal. Any help will be appreciated.

This is how I am rendering the modal view in my provider:

return $panel ->default() ->id('admin') ....... ->plugins([ FilamentShieldPlugin::make() ]) ->renderHook( 'panels::auth.login.form.after', fn () => view('auth.socialite.google') ) ->renderHook( PanelsRenderHook::CONTENT_END, function (): View { return view('livewire.set-username'); } );
Solution
public function init(): void
{
    $this->dispatch('open-modal', id: 'setUsernameModal');
}


<x-filament-widgets::widget>
    <x-filament::modal wire:init="init" id="setUsernameModal">
        <div>...</div>
    </x-filament::modal>
</x-filament-widgets::widget>
Was this page helpful?