fix broadcast error with event
This commit is contained in:
@@ -73,8 +73,8 @@ class TasksController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$task = Task::find($request["task_id"]);
|
||||||
$task = Task::with('event')->find($request["task_id"]);
|
$event = \App\Models\Events::find($task->events_id);
|
||||||
|
|
||||||
if ($task->users()->where('user_id', $id)->exists()) {
|
if ($task->users()->where('user_id', $id)->exists()) {
|
||||||
return response()->json(["message" => "User already assigned to this task"], 400);
|
return response()->json(["message" => "User already assigned to this task"], 400);
|
||||||
@@ -88,10 +88,11 @@ class TasksController extends Controller
|
|||||||
|
|
||||||
if($user) {
|
if($user) {
|
||||||
$task->users()->attach($id);
|
$task->users()->attach($id);
|
||||||
|
|
||||||
broadcast(new VolunteerAssignedToTask(
|
broadcast(new VolunteerAssignedToTask(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$task->event
|
$event
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +125,8 @@ class TasksController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = Task::with(['users', 'event'])->find($id);
|
$task = Task::with(['users'])->find($id);
|
||||||
|
$event = \App\Models\Events::find($task->events_id);
|
||||||
|
|
||||||
if (!$task) {
|
if (!$task) {
|
||||||
return response()->json(["message" => "Task not found"], 404);
|
return response()->json(["message" => "Task not found"], 404);
|
||||||
@@ -136,7 +138,7 @@ class TasksController extends Controller
|
|||||||
broadcast(new TaskParticipationCancelled(
|
broadcast(new TaskParticipationCancelled(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$task->event
|
$event
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +209,8 @@ class TasksController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = Task::with('event')->find($request["task_id"]);
|
$task = Task::find($request["task_id"]);
|
||||||
|
$event = \App\Models\Events::find($task->events_id);
|
||||||
|
|
||||||
if (!$task) {
|
if (!$task) {
|
||||||
return response()->json(["message" => "Task not found"], 404);
|
return response()->json(["message" => "Task not found"], 404);
|
||||||
@@ -226,7 +229,7 @@ class TasksController extends Controller
|
|||||||
broadcast(new VolunteerUnassignedFromTask(
|
broadcast(new VolunteerUnassignedFromTask(
|
||||||
$user->id,
|
$user->id,
|
||||||
$task,
|
$task,
|
||||||
$task->event
|
$event
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user