validate([ 'body' => 'required|string|max:1000', ]); Comment::create([ 'user_id' => Auth::id(), 'product_id' => $product->id, 'body' => $validated['body'], ]); return back()->with('success', 'Comment posted successfully!'); } /** * Remove the specified comment. */ public function destroy(Comment $comment): RedirectResponse { Gate::authorize('delete-comment', $comment); $comment->delete(); return back()->with('success', 'Comment deleted successfully!'); } }