comments()->with('user')->latest()->get(); $html = view('components.dashboard.user.deal-comment.index', compact('comments'))->render(); return response()->json(['html' => $html]); } public function store(Deal $deal, CommentRequest $request) { $data = $request->validated(); $data['user_id'] = $request->user()->id; $data['deal_id'] = $deal->id; Comment::create($data); return response()->json(['message' => 'Comment created successfully.'], 201); } public function show(Comment $comment) {} public function update(CommentRequest $request, Comment $comment) { $comment->update($request->validated()); } public function destroy(Comment $comment) { $comment->delete(); return response()->json(); } }