/** * 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')); }
/** * 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 a listing of the resource. * * @return Response */ public function index(ApiRepository $apirepo) { $popularCandidate = \App\LikeCandidate::select('*', \DB::raw('count(candidate_id) as count'))->groupBy('candidate_id')->orderBy('count', 'desc')->take(4)->get(); $data; foreach ($popularCandidate as $key => $value) { $candidate = $apirepo->getCandidateById($value->candidate_id); $candidate->data->likeCount = $value->count; $data[] = $candidate; } return view('main.home', compact('data')); }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request, ApiRepository $apirepo) { if ($request->has('page')) { //so you can search like this http://localhost/ewa2015/public/candidate?page=1&gender=F&party=1&blahblah=foobar $faqList = $apirepo->getFaqList($request->input('page')); } else { //if request have no parameter here u go with normal pagination list $faqList = $apirepo->getFaqList(); } dd($faqList); return view('faq.all', compact('faqList')); }
public function upperHouse(Request $request, ApiRepository $apirepo) { $upperHouse = $apirepo->getUpperHouseBySearch($request); return json_encode($upperHouse); }
public function compare($p1, $p2, ApiRepository $apirepo) { $person = $apirepo->getCandidateById($p1); $person1 = $apirepo->getCandidateById($p2); return view('candidate.compare', compact('person', 'person1')); }
public function candidateListSearch(ApiRepository $apirepo, Request $request) { $candidateList = $apirepo->getCandidateListBySearch($request); dd($candidateList); }