articlesService->getArticles(true); return view('community.articles', [ 'articles' => $articles, ]); } public function show(WebsiteArticle $article): View { $reactions = $article->reactions() ->with('user:id,username') ->get(); return view('community.article', [ 'article' => $article, 'otherArticles' => WebsiteArticle::whereKeyNot($article->id)->with('user:id,username,look')->latest('id')->take(15)->get(), 'myReactions' => Auth::check() ? $reactions->where('user_id', Auth::id())->pluck('reaction') : [], 'articleReactions' => $reactions->groupBy('reaction', true), ]); } public function toggleReaction(WebsiteArticle $article, Request $request): JsonResponse { $response = $this->reactionService->toggleReaction($article, Auth::user(), $request); return response()->json($response); } }