0

I am unable to find in the documentation of how to handle the notification (what to do if notification is sent successfully or not)

NotificationController

public function AskForLevelUp()
{
    $admin = User::where('is_admin', 1)->first();

    $sendNotification = Notification::send($admin, new LevelUpNotification(Auth::user()->id));

    if ($sendNotification->success()) // **HOW TO DO THIS CORRECTLY**
    {
        return back()->with('success', 'Your request has been submitted, please wait for admin confirmation.');
    }
    else
    {
        return back()->with('failure', 'Something went wrong, your request is not submitted. Please try again later.');
    }
}

I've also read that send() has void return value here. Does anyone know how to handle this?

0 Answers0