FilamentF
Filament15mo ago
Zoltar

Action in custom page

Hello,

Have a simple button in blade view

<x-filament::button wire:click="challenge" class="primary-bg">
   Challenge
</x-filament::button>


in my custom page, function challenge() call an action

   //Challenge
    public function challenge()
    {   
        Action::make('sendEmail')
            ->form([
                TextInput::make('subject')->required(),
                RichEditor::make('body')->required(),
            ])
            ->action(function (array $data) {
                Mail::to($this->client)
                    ->send(new GenericEmail(
                        subject: $data['subject'],
                        body: $data['body'],
                    ));
            });
    }


when try to click button get error

Method Filament\Notifications\Actions\Action::form does not exist.

any suggest?

thanks
Solution
The action name should match the function name
Was this page helpful?