F
Filament2mo ago
Luiz

Actions\Action not calling the action method when combined with form

I'm trying to create a custom form that executes a custom action after submitting but the method action is never called.
use Filament\Actions;
use Filament\Forms;

Actions\Action::make('add_role')
->label('Assign role')
->color('info')
->visible(fn () => Auth::user()->is_system_admin || Auth::user()->is_back_officer)
->form(function (User $record) {
$options = static::getRoleOptions($record);

return [
Forms\Components\Select::make('role')
->label('Role')
->options($options)
->native(false)
->required(),

Forms\Components\Group::make()
->schema(fn (Get $get) => match ($get('role')) {
'guest' => [],
default => []
}),
];
})
->action(function () {
Notification::make()
->success()
->title('New role assigned successfully.')
->send();
})
use Filament\Actions;
use Filament\Forms;

Actions\Action::make('add_role')
->label('Assign role')
->color('info')
->visible(fn () => Auth::user()->is_system_admin || Auth::user()->is_back_officer)
->form(function (User $record) {
$options = static::getRoleOptions($record);

return [
Forms\Components\Select::make('role')
->label('Role')
->options($options)
->native(false)
->required(),

Forms\Components\Group::make()
->schema(fn (Get $get) => match ($get('role')) {
'guest' => [],
default => []
}),
];
})
->action(function () {
Notification::make()
->success()
->title('New role assigned successfully.')
->send();
})
But the submit button never resolves
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server