Notification Not Showing!

I am implementing custom notification on a custom action button. Here is the code

Forms\Components\Section::make('Import From Box')
                            ->headerActions([
                                Forms\Components\Actions\Action::make('Fetch')
                                    ->action(fn (BoxApi $boxApi, Forms\Set $set, ?array $state) => static::fetchBoxApi($boxApi, $set, $state))
                                    ->failureNotification(static::createNotification(
                                        'Value Not Found!', 'Please make sure its a valid URL!'
                                    ))
                                    ->successNotification(static::createNotification(
                                        'Successful', 'Value Has been Imported!'
                                    )),
                            ])
                            ->schema([
                                ...
                            ])->columns(2),


private static function createNotification(string $title, string $body): Notification
    {
        return Notification::make()
            ->danger()
            ->title($title)
            ->body($body);
    }


I have set for failure and success notification like this

->failureNotification(static::createNotification(
                                        'Value Not Found!', 'Please make sure its a valid URL!'
                                    ))
                                    ->successNotification(static::createNotification(
                                        'Successful', 'Value Has been Imported!'
                                    )),


and still there's no notification poping up.
Solution
private static function createNotification(string $title, string $body): Notification
    {
        return Notification::make()
            ->danger()
            ->title($title)
            ->body($body)
            ->send();
    }
Was this page helpful?