store/app/Services/System/PushNotificationService.php

24 lines
694 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, []);
}
}