2019-11-20 23:16:01 +08:00
|
|
|
<?php
|
|
|
|
|
2020-09-04 00:50:42 +08:00
|
|
|
namespace App\Contracts;
|
2019-11-20 23:16:01 +08:00
|
|
|
|
2021-06-04 22:51:59 +08:00
|
|
|
use App\Notifications\Channels\Discord\DiscordMessage;
|
2019-11-20 23:16:01 +08:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
|
2020-09-04 00:50:42 +08:00
|
|
|
class Notification extends \Illuminate\Notifications\Notification implements ShouldQueue
|
2019-11-20 23:16:01 +08:00
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
public $channels = [];
|
2020-09-04 00:50:42 +08:00
|
|
|
public $requires_opt_in = false;
|
2019-11-20 23:16:01 +08:00
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
// Look in the notifications.channels config and see where this particular
|
|
|
|
// notification can go. Map it to $channels
|
2021-06-04 22:51:59 +08:00
|
|
|
/*$klass = static::class;
|
2019-11-20 23:16:01 +08:00
|
|
|
$notif_config = config('notifications.channels', []);
|
|
|
|
if (!array_key_exists($klass, $notif_config)) {
|
2020-05-09 23:31:25 +08:00
|
|
|
Log::error('Notification type '.$klass.' missing from notifications config, defaulting to mail');
|
2019-11-20 23:16:01 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-04 22:51:59 +08:00
|
|
|
$this->channels = $notif_config[$klass];*/
|
2019-11-20 23:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2021-06-04 22:51:59 +08:00
|
|
|
/*public function via($notifiable)
|
2019-11-20 23:16:01 +08:00
|
|
|
{
|
|
|
|
return $this->channels;
|
2021-06-04 22:51:59 +08:00
|
|
|
}*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return DiscordMessage|null
|
|
|
|
*/
|
|
|
|
public function toDiscordChannel($notifiable): ?DiscordMessage
|
|
|
|
{
|
|
|
|
return null;
|
2019-11-20 23:16:01 +08:00
|
|
|
}
|
|
|
|
}
|