Files
daily-meal-api/app/Notifications/NewFollowerNotification.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

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()}"),
];
}
}