0273fbfddd
- Notifier helper: guarda en BD + broadcast en un solo llamado - AppNotification: notificación genérica para canal database - FriendshipController: notifica al recibir solicitud y al aceptarla - PostController: notifica al autor cuando le dan like o comentan (excepto en propio post) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
826 B
PHP
36 lines
826 B
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class AppNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public readonly string $title,
|
|
public readonly string $body = '',
|
|
public readonly ?string $url = null,
|
|
public readonly string $icon = 'fa-bell',
|
|
public readonly string $color = 'primary',
|
|
) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database'];
|
|
}
|
|
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
'title' => $this->title,
|
|
'body' => $this->body,
|
|
'url' => $this->url,
|
|
'icon' => $this->icon,
|
|
'color' => $this->color,
|
|
];
|
|
}
|
|
}
|