Files
daily-meal-api/app/Notifications/CertificationReviewedNotification.php
leonm df4f523089
CI / 🧪 Tests Laravel (push) Successful in 2m7s
CI / 🐳 Build & Push Image (push) Successful in 42s
feat: add persistent mobile notifications
2026-08-11 16:46:05 +02:00

40 lines
1.3 KiB
PHP

<?php
namespace App\Notifications;
use App\Enums\IdentityVerificationStatus;
use App\Models\IdentityVerificationRequest;
use App\Services\MobileDeepLink;
class CertificationReviewedNotification extends MobileNotification
{
public function __construct(
private readonly IdentityVerificationRequest $verificationRequest,
) {
parent::__construct();
}
protected function category(): string
{
return self::CATEGORY_ACCOUNT;
}
protected function payload(object $notifiable): array
{
$approved = $this->verificationRequest->status === IdentityVerificationStatus::APPROVED;
return [
'type' => $approved ? 'certification_approved' : 'certification_rejected',
'title' => $approved
? __('api.notifications.certification_approved_title')
: __('api.notifications.certification_rejected_title'),
'body' => $approved
? __('api.notifications.certification_approved_body')
: __('api.notifications.certification_rejected_body', [
'reason' => $this->verificationRequest->rejection_reason,
]),
'url' => MobileDeepLink::to('profile/settings/certification'),
];
}
}