Refactor broadcast notifications (#1402)
* Refactor broadcast notifications * StyleCI fixes * Fix the planned_distance accidental changes
This commit is contained in:
@@ -4,8 +4,6 @@ namespace App\Notifications\Messages;
|
||||
|
||||
use App\Contracts\Notification;
|
||||
use App\Models\User;
|
||||
use App\Notifications\Channels\Discord\DiscordMessage;
|
||||
use App\Notifications\Channels\Discord\DiscordWebhook;
|
||||
use App\Notifications\Channels\MailChannel;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
@@ -32,32 +30,21 @@ class AdminUserRegistered extends Notification implements ShouldQueue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $notifiable
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail', DiscordWebhook::class];
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Discord notification
|
||||
* @param $notifiable
|
||||
*
|
||||
* @param User $pirep
|
||||
* @param mixed $user
|
||||
*
|
||||
* @return DiscordMessage|null
|
||||
* @return array
|
||||
*/
|
||||
public function toDiscordChannel($user): ?DiscordMessage
|
||||
{
|
||||
if (empty(setting('notifications.discord_private_webhook_url'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$dm = new DiscordMessage();
|
||||
return $dm->webhook(setting('notifications.discord_private_webhook_url'))
|
||||
->success()
|
||||
->title('New User Registered: '.$user->ident)
|
||||
->fields([]);
|
||||
}
|
||||
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user