2020-08-31 21:06:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Traits;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Facades\Options;
|
|
|
|
|
|
|
|
trait Cancellable
|
|
|
|
{
|
|
|
|
|
2020-10-09 23:39:53 +00:00
|
|
|
// 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.
|
2020-08-31 21:06:00 +00:00
|
|
|
public function chooseChannelsViaOptions()
|
|
|
|
{
|
|
|
|
$channels = [];
|
|
|
|
|
|
|
|
if (Options::getOption('enable_slack_notifications') == 1)
|
|
|
|
{
|
|
|
|
array_push($channels, 'slack');
|
|
|
|
}
|
2020-10-09 23:39:53 +00:00
|
|
|
|
|
|
|
if (Options::getOption('enable_email_notifications') == 1)
|
2020-08-31 21:06:00 +00:00
|
|
|
{
|
|
|
|
array_push($channels, 'email');
|
|
|
|
}
|
|
|
|
|
2020-10-09 23:39:53 +00:00
|
|
|
if (Options::getOption('enable_discord_notifications'))
|
|
|
|
{
|
|
|
|
array_push($channels, 'discord');
|
|
|
|
}
|
|
|
|
|
2020-08-31 21:06:00 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|