Example #1
0
 public function actionCreate(Requests\CreateRatingRequest $request)
 {
     $rating = new Rating($request->all());
     Auth::user()->ratings()->save($rating);
     \Session::flash('flash_message', 'You have successfully created a rating.');
     return redirect('/ratings/' . $rating->id);
 }
 public function storeRating($id, CreateRatingRequest $request)
 {
     $input = $request->all();
     if ($input['rating'] == null) {
         flash()->error("You must choose a value in order to rate this series.");
         return \Redirect::back();
     }
     $newrating = new Rating();
     $newrating->rating = $input['rating'];
     $newrating->userId = Auth::id();
     $newrating->seriesId = $input['sId'];
     //we already know that the "requester" hasn't rated this serie yet
     addRating($newrating);
     flash()->success("Your rating has been stored successfully.");
     return \Redirect::back();
 }