/** * Display the specified resource. * * @param int $id * @return Response */ public function show(ApiRepository $apiRepository, $id) { try { $party = $apiRepository->getPartyById($id); return view('party.show', compact('party')); } catch (Exception $e) { echo $e->message; } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Request $request, ApiRepository $apiRepository, $id) { $likes = \App\LikeParty::where('party_id', $id)->count(); $party = $apiRepository->getPartyById($id); if ($request->ajax()) { return json_encode($party); } return view('party.show', compact('party', 'likes')); }