32 lines
802 B
PHP
32 lines
802 B
PHP
<?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()}"),
|
|
];
|
|
}
|
|
}
|