add notifications logic and add support of both JWT and Sanctum
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Notifications;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class NotificationTriggerService
|
||||
{
|
||||
public static function trigger(string $eventType, array $payload): void
|
||||
{
|
||||
Event::dispatch($eventType, $payload);
|
||||
}
|
||||
|
||||
public static function toUser(int $userId, string $title, string $message, array $channels = ['in_app']): void
|
||||
{
|
||||
self::trigger('customNotification', [
|
||||
'user_id' => $userId,
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'channels' => $channels,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user