mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-11-04 05:13:34 +01:00
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Enums\Models\User\NotificationType;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class UserNotification extends Notification implements Arrayable, ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public string $title,
|
|
public string $body,
|
|
public NotificationType $type,
|
|
public ?string $image = null,
|
|
) {}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @return array
|
|
*
|
|
* @noinspection PhpUnusedParameterInspection
|
|
*/
|
|
public function via($notifiable): array
|
|
{
|
|
return ['database'];
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'title' => $this->title,
|
|
'body' => $this->body,
|
|
'type' => $this->type->value,
|
|
'image' => $this->image,
|
|
];
|
|
}
|
|
}
|