add $notificationId to every broadcast notification

This commit is contained in:
2026-03-19 18:09:11 +01:00
parent ec76ca981a
commit 9fbc09017b
10 changed files with 33 additions and 10 deletions
+3 -1
View File
@@ -16,14 +16,16 @@ class EventParticipationCancelled implements ShouldBroadcastNow
public $userId; public $userId;
public $event; public $event;
public $notificationId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, Event $event) public function __construct($userId, Event $event, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->event = $event; $this->event = $event;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -18,18 +18,20 @@ class TaskDateUpdated implements ShouldBroadcastNow
public $event; public $event;
public $start; public $start;
public $end; public $end;
public $notificationId;
protected $userId; protected $userId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, Task $task, Event $event, $start, $end) public function __construct($userId, Task $task, Event $event, $start, $end, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->task = $task; $this->task = $task;
$this->event = $event; $this->event = $event;
$this->start = $start; $this->start = $start;
$this->end = $end; $this->end = $end;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -17,15 +17,17 @@ class TaskParticipationCancelled implements ShouldBroadcastNow
public $userId; public $userId;
public $task; public $task;
public $event; public $event;
public $notificationId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, Task $task, Event $event) public function __construct($userId, Task $task, Event $event, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->task = $task; $this->task = $task;
$this->event = $event; $this->event = $event;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -15,13 +15,15 @@ class UserCreated implements ShouldBroadcastNow
public $user; public $user;
public $notificationId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct(User $user) public function __construct(User $user, $notificationId)
{ {
$this->user = $user; $this->user = $user;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -16,16 +16,18 @@ class VolunteerAssignedToTask implements ShouldBroadcastNow
public $task; public $task;
public $event; public $event;
public $notificationId;
protected $userId; protected $userId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, Task $task, Event $event) public function __construct($userId, Task $task, Event $event, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->task = $task; $this->task = $task;
$this->event = $event; $this->event = $event;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -15,15 +15,17 @@ class VolunteerRoleUpdated implements ShouldBroadcastNow
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;
public $role; public $role;
public $notificationId;
protected $userId; protected $userId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, $role) public function __construct($userId, $role, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->role = $role; $this->role = $role;
$this->notificationId = $notificationId;
} }
/** /**
+3 -1
View File
@@ -17,15 +17,17 @@ class VolunteerUnassignedFromTask implements ShouldBroadcastNow
public $userId; public $userId;
public $task; public $task;
public $event; public $event;
public $notificationId;
/** /**
* Create a new event instance. * Create a new event instance.
*/ */
public function __construct($userId, Task $task, Event $event) public function __construct($userId, Task $task, Event $event, $notificationId)
{ {
$this->userId = $userId; $this->userId = $userId;
$this->task = $task; $this->task = $task;
$this->event = $event; $this->event = $event;
$this->notificationId = $notificationId;
} }
/** /**
+2 -1
View File
@@ -107,7 +107,8 @@ class EventsController extends Controller
foreach ($participants as $user) { foreach ($participants as $user) {
broadcast(new EventParticipationCancelled( broadcast(new EventParticipationCancelled(
$user->id, $user->id,
$event $event,
$notification->id,
)); ));
$data = [ $data = [
+4
View File
@@ -107,6 +107,7 @@ class TasksController extends Controller
$user->id, $user->id,
$task, $task,
$event, $event,
$notification->id,
)); ));
$data = [ $data = [
@@ -171,6 +172,7 @@ class TasksController extends Controller
$user->id, $user->id,
$task, $task,
$event, $event,
$notification->id,
)); ));
$data = [ $data = [
@@ -224,6 +226,7 @@ class TasksController extends Controller
$event, $event,
FormatDate::formatDate($request["start"]), FormatDate::formatDate($request["start"]),
FormatDate::formatDate($request["end"]), FormatDate::formatDate($request["end"]),
$notification->id,
)); ));
$data = [ $data = [
@@ -306,6 +309,7 @@ class TasksController extends Controller
$user->id, $user->id,
$task, $task,
$event, $event,
$notification->id,
)); ));
$data = [ $data = [
+6 -2
View File
@@ -61,7 +61,10 @@ class UserController extends Controller
$notification->users()->attach( $notification->users()->attach(
$admins->pluck('id')->toArray() $admins->pluck('id')->toArray()
); );
broadcast(new UserCreated($user)); broadcast(new UserCreated(
$user,
$notification->id,
));
foreach ($admins as $admin) { foreach ($admins as $admin) {
$data = [ $data = [
@@ -263,7 +266,8 @@ class UserController extends Controller
broadcast(new VolunteerRoleUpdated( broadcast(new VolunteerRoleUpdated(
$user->id, $user->id,
$role $role,
$notification->id,
)); ));
$data = [ $data = [