34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages\Verification\Services;
|
|
|
|
use App\Filament\Resources\Manage\Partners\PartnerResource;
|
|
use App\Filament\Support\CheerfulNotification;
|
|
use App\Models\User;
|
|
use App\Notifications\BroadcastNotification;
|
|
use Filament\Actions\Action;
|
|
|
|
class VerificationAdminNotifier
|
|
{
|
|
public function notifySuperAdmins(User $actor, bool $isRevision): void
|
|
{
|
|
$companyName = $actor->company?->name;
|
|
|
|
User::superAdmin()->get()->each(function (User $admin) use ($actor, $companyName, $isRevision): void {
|
|
$admin->notify(new BroadcastNotification([
|
|
'title' => $isRevision
|
|
? CheerfulNotification::getByKey('verification.admin_notify.title.revision')
|
|
: CheerfulNotification::getByKey('verification.admin_notify.title.new'),
|
|
'body' => $isRevision
|
|
? CheerfulNotification::getByKey('verification.admin_notify.body.revision', ['name' => $actor->name, 'company' => $companyName])
|
|
: CheerfulNotification::getByKey('verification.admin_notify.body.new', ['name' => $actor->name, 'company' => $companyName]),
|
|
'action' => [
|
|
Action::make('view')
|
|
->label('Lihat')
|
|
->url(PartnerResource::getUrl('view', ['record' => $actor])),
|
|
],
|
|
]));
|
|
});
|
|
}
|
|
}
|