public function storeRestaurant(Request $request, $id) { $poll = \App\Poll::findOrFail($id); $restaurant = Restaurant::findOrFail($request->input('restaurant_id')); $poll->restaurants()->save($restaurant); return redirect()->route('poll.index', ['orgId' => $poll->organization_id]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CreateRatingRequest $request, $id) { $restaurant = Restaurant::findOrFail($id); $rating = new Rating(); $rating->fill($request->input()); $rating->restaurant()->associate($restaurant); $rating->save(); return $restaurant; }