feat: add persistent mobile notifications
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user