staffmanager/app/Traits/Cancellable.php

58 lines
1.0 KiB
PHP

<?php
namespace App\Traits;
use App\Facades\Options;
trait Cancellable
{
// This method is only used if you want this default set of channels;
// Other channels can always be configured by overloading the channels method here.
public function chooseChannelsViaOptions()
{
$channels = [];
if (Options::getOption('enable_slack_notifications') == 1)
{
array_push($channels, 'slack');
}
if (Options::getOption('enable_email_notifications') == 1)
{
array_push($channels, 'email');
}
if (Options::getOption('enable_discord_notifications'))
{
array_push($channels, 'discord');
}
return $channels;
}
public function channels()
{
return ['mail'];
}
public function via($notifiable)
{
if ($this->optOut($notifiable))
{
return [];
}
return $this->channels();
}
public function optOut($notifiable)
{
return false;
}
}