Notification not working from Action Component

hello , I have this small action
the notifications fail to lunch with no errors showed , the action works
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('triggerBanLogic')
        ->label('Ban')
        ->successNotificationTitle('The user has been successfully banned.')
        ->failureNotificationTitle('failed')
        ->closeModalByClickingAway(false)
        ->modalHeading('Ban User')
        ->icon('heroicon-o-no-symbol')
        ->color('danger')
        ->form([
            Forms\Components\Group::make()
                ->schema([
                    Forms\Components\Radio::make('banType')
                        ->label('')
                        ->required()
                        ->live()
                        ->columnSpan(1)
                        ->default('PermanentBan')
                        ->options([
                            'PermanentBan' => 'Permanent Ban',
                            'TemporaryBan' => 'Temporary Ban',
                        ]),
                    Forms\Components\DatePicker::make('expires_at')
                        ->label('Ban until')
                        ->required()
                        ->displayFormat('d/m/Y')
                        ->closeOnDateSelection()
                        ->visible(fn (Get $get) => $get('banType') === 'TemporaryBan')
                        ->minDate(now()->addDay()),
                    Forms\Components\TextInput::make('comment')
                        ->label('Comment (Ban Reason)')
                        ->required()
                        ->columnSpanFull(),
                ])->columns(2)
        ])
        ->action(function (array $data, User $record) {
            $data['banned_by'] = auth()->id();
            $record->ban($data);
        })
])->fullWidth()
Solution
inside the action() method we can initiate a notification without the need to use successNotificationTitle() method {wich didnt work me}
->action(function (array $data) {
   // your logic
   Notification::make()
   ->success()
   ->title('test')
   ->body('test')
   ->send();
})
Was this page helpful?