27 lines
709 B
PHP
27 lines
709 B
PHP
<?php
|
|
|
|
namespace App\Services\System;
|
|
|
|
use App\Jobs\SendPushNotificationJob;
|
|
|
|
class PushNotificationService
|
|
{
|
|
|
|
public function sendToRoles(string $title, string $body, array $roles, string $url = '/admin/dashboard'): void
|
|
{
|
|
SendPushNotificationJob::dispatch($title, $body, $url, $roles);
|
|
}
|
|
|
|
|
|
public function sendToUser(string $title, string $body, int $userId, string $url = '/admin/dashboard'): void
|
|
{
|
|
SendPushNotificationJob::dispatch($title, $body, $url, [], $userId);
|
|
}
|
|
|
|
|
|
public function sendToAll(string $title, string $body, string $url = '/admin/dashboard'): void
|
|
{
|
|
SendPushNotificationJob::dispatch($title, $body, $url, []);
|
|
}
|
|
}
|