user(); if ($event->status === EventStatus::Cancelled) { abort(403); } if (!$user->canAccessAdminPanel()) { if ($event->status === EventStatus::Draft) { abort(403); } if (!$user->accessibleTeamIds()->contains($event->team_id)) { abort(403); } } $request->validate([ 'body' => 'required|string|max:1000', ]); $comment = $event->comments()->make(['body' => $request->body]); $comment->user_id = auth()->id(); $comment->save(); ActivityLog::log('created', __('admin.log_comment_created', ['event' => $event->title]), 'Event', $event->id); return redirect(route('events.show', $event) . '#comments'); } }