/** * 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')); }
public function checkLikeParty($partyId) { return \App\LikeParty::where('party_id', $partyId)->where('user_id', auth()->user()->id)->count(); }
protected function checkLikeExist($candidateId) { $result = \App\LikeParty::where('user_id', auth()->user()->id)->where('party_id', $candidateId)->count(); return $result; }