comments()->latest()->paginate(); return view('projects.comments', compact('project', 'comments')); } /** * Store a new comment in storage. * * @param \Illuminate\Http\Request $request * @param \App\Entities\Projects\Project $project * @return \Illuminate\Http\RedirectResponse */ public function store(Request $request, Project $project) { $this->authorize('view', $project); $newComment = $request->validate([ 'body' => 'required|string|max:255', 'fu_type_id' => 'nullable|numeric', 'objection_id' => 'nullable|numeric', ]); $project->comments()->create([ 'body' => $newComment['body'], 'creator_id' => auth()->id(), ]); flash(__('comment.created'), 'success'); return back(); } }