feat: add persistent mobile notifications
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\MobileDeepLink;
|
||||
|
||||
class NewFollowerNotification extends MobileNotification
|
||||
{
|
||||
public function __construct(private readonly User $follower)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function category(): string
|
||||
{
|
||||
return self::CATEGORY_SOCIAL;
|
||||
}
|
||||
|
||||
protected function payload(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'type' => 'new_follower',
|
||||
'title' => __('api.notifications.new_follower_title'),
|
||||
'body' => __('api.notifications.new_follower_body', [
|
||||
'name' => $this->follower->name ?: __('api.notifications.someone'),
|
||||
]),
|
||||
'url' => MobileDeepLink::to("users/{$this->follower->getKey()}"),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user