Created
February 17, 2018 23:34
-
-
Save hotmeteor/565909f440161747362e601d7f623a56 to your computer and use it in GitHub Desktop.
Handling delayed notifications in Laravel, pt. 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Notifications; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Notifications\Notification; | |
use Illuminate\Queue\SerializesModels; | |
class AppointmentReminder extends Notification implements ShouldQueue | |
{ | |
use Queueable, SerializesModels; | |
public $appointment; | |
public function __construct(Appointment $appointment) | |
{ | |
$this->appointment = $appointment; | |
$this->delay($appointment->start_date_time)->subDay(1); | |
} | |
public function via($notifiable) | |
{ | |
return ['mail']; | |
} | |
public function toMail() | |
{ | |
// Return mail contents | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment