-
Add the
SnoozeNotifiable
trait to your notifiable model -
Create the basic notification:
php artisan make:notification OneWeekAfterNotice
-
Get the datetime for when we should send the notification
$sendAt = Carbon::now()->addDays(7)
// 7 days from now- Here is a reference to Carbon if you need help creating future dates
- Note: Make sure you have imported carbon with
use Carbon\Carbon;
at the top of your file
-
Schedule the notification for a notifiable User
Auth::user()->notifyAt(new OneWeekAfterNotice(), $sentAt);
- Our notification will be saved in our
scheduled_notifications
table, and will be sent the first time oursnooze:send
command runs following the$send_at
date.