Files
Sistema-Educativo-Laravel/app/Notifications/AppNotification.php
T
fernando 0273fbfddd feat: notificaciones en tiempo real para social (likes, comentarios, solicitudes)
- 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>
2026-04-28 17:15:28 -06:00

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