2020-08-31 21:06:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Traits;
|
|
|
|
|
2020-10-21 00:29:50 +00:00
|
|
|
|
2020-08-31 21:06:00 +00:00
|
|
|
use App\Facades\Options;
|
|
|
|
|
|
|
|
trait Cancellable
|
|
|
|
{
|
2020-10-21 00:29:50 +00:00
|
|
|
|
2020-08-31 21:06:00 +00:00
|
|
|
public function chooseChannelsViaOptions()
|
|
|
|
{
|
|
|
|
$channels = [];
|
|
|
|
|
2020-10-21 00:29:50 +00:00
|
|
|
if (Options::getOption('enable_slack_notifications') == 1)
|
|
|
|
{
|
2020-08-31 21:06:00 +00:00
|
|
|
array_push($channels, 'slack');
|
2020-10-21 00:29:50 +00:00
|
|
|
}
|
|
|
|
elseif(Options::getOption('enable_email_notifications') == 1)
|
|
|
|
{
|
2020-08-31 21:06:00 +00:00
|
|
|
array_push($channels, 'email');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $channels;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function channels()
|
|
|
|
{
|
|
|
|
return ['mail'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function via($notifiable)
|
|
|
|
{
|
2020-10-21 00:29:50 +00:00
|
|
|
if ($this->optOut($notifiable))
|
|
|
|
{
|
2020-08-31 21:06:00 +00:00
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->channels();
|
|
|
|
}
|
|
|
|
|
2020-10-21 00:29:50 +00:00
|
|
|
|
2020-08-31 21:06:00 +00:00
|
|
|
public function optOut($notifiable)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2020-10-21 00:29:50 +00:00
|
|
|
|
2020-08-31 21:06:00 +00:00
|
|
|
}
|