/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Request $request, $id) { $pollResponse = $request->user()->pollResponses()->where('polls_restaurants.poll_id', '=', $id)->first(); $poll = \App\Poll::findOrFail($id); $pollRestaurants = PollRestaurant::where('poll_id', '=', $id)->get(); return view('polls.view', ['poll' => $poll, 'response' => $pollResponse, 'pollRestaurants' => $pollRestaurants]); }
public function pollRestaurants($poll_id) { $pollRestaurant = \App\PollRestaurant::where('restaurant_id', '=', $this->id)->where('poll_id', '=', $poll_id)->first(); return $pollRestaurant; }