Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Qms;
|
|
|
|
use App\Models\Member;
|
|
use App\Models\Organization;
|
|
use App\Models\User;
|
|
use App\Notifications\Qms\QueueStaffNotification;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class StaffNotifier
|
|
{
|
|
/**
|
|
* @param list<string> $roles
|
|
*/
|
|
public function notifyOrganization(
|
|
Organization $organization,
|
|
Notification $notification,
|
|
array $roles = ['org_admin', 'branch_manager', 'supervisor'],
|
|
): void {
|
|
$refs = Member::query()
|
|
->where('organization_id', $organization->id)
|
|
->whereIn('role', $roles)
|
|
->pluck('user_ref');
|
|
|
|
User::query()
|
|
->whereIn('public_id', $refs)
|
|
->each(fn (User $user) => $user->notify($notification));
|
|
}
|
|
|
|
public function queueEvent(
|
|
Organization $organization,
|
|
string $title,
|
|
string $message,
|
|
?string $url = null,
|
|
string $icon = 'bell',
|
|
): void {
|
|
$this->notifyOrganization($organization, new QueueStaffNotification($title, $message, $url, $icon));
|
|
}
|
|
}
|