Make notifications cancellable
This commit makes certain notifications cancellable. This enables notifications to be sent conditionally based on the user's choice.
This commit is contained in:
@@ -9,10 +9,12 @@ use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Vacancy;
|
||||
use App\Facades\Options;
|
||||
use App\Traits\Cancellable;
|
||||
|
||||
class VacancyClosed extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels, Cancellable;
|
||||
|
||||
protected $vacancy;
|
||||
|
||||
@@ -26,15 +28,9 @@ class VacancyClosed extends Notification implements ShouldQueue
|
||||
$this->vacancy = $vacancy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
public function optOut($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
return Options::getOption('notify_vacancystatus_change') !== 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user