Files
construprogress/app/Notifications/IssueAssignedNotification.php
Javier Braña 9222eefdf9 feat: Phase 2 - Laravel Reverb + real-time notifications
- Install laravel/reverb + laravel-echo + pusher-js
- Configure broadcasting to reverb in .env.example + .env
- Add Echo + Pusher client in resources/js/app.js
- Update all 14 notifications to implement ShouldBroadcast + broadcastOn()
- Update NotificationBell component to listen for real-time events
- Add Livewire.emit in notification-bell blade for JS-to-Livewire bridge

Tests: 101 passing (319 assertions)
2026-08-31 12:16:56 +02:00

36 lines
958 B
PHP

<?php
namespace App\Notifications;
use App\Models\Issue;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Notifications\Notification;
class IssueAssignedNotification extends Notification implements ShouldBroadcast
{
use Queueable;
public function __construct(public Issue $issue) {}
public function via($notifiable): array
{
return ['database', 'broadcast'];
}
public function toArray($notifiable): array
{
return [
'type' => 'issue_assigned',
'issue_id' => $this->issue->id,
'project_id' => $this->issue->project_id,
'priority' => $this->issue->priority,
'message' => "Se te ha asignado la incidencia '{$this->issue->title}'",
];
}
public function broadcastOn(): array
{
return [new \Illuminate\Broadcasting\PrivateChannel('user.'.$this->issue->assigned_to)];
}
}