/** * 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; }