Custom Page: open modal from link

Hey there.

I have a custom page php artisan make:filament-page MyPage. In there I want a link that once clicked, opens a modal.
This modal needs to go to the server and fetch something (so it's not just a JS modal).

How can I achieve this?

I've been wrestling with the docs to try and solve this for a while now.

<!-- my-page.blade.php -->
<x-filament-panels::page>
    {{ $this->updateUserAction }}
    
    <x-filament-actions::modals />
</x-filament-panels::page>


use InteractsWithActions;
use InteractsWithForms;

public function updateUserAction(): Action
{
    return Action::make('updateUserAction')
        ->action(fn () => User::first()->update(['name' => Str::random()]))
        ->requiresConfirmation();
}


The example makes no sense but if it works, I would be happy.

The button is shown but when clicked, the php request is fired but no modal appears with the response (code 200).

Am I missing something?
Was this page helpful?