/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $validator = Validator::make($request->all(), $this->getValidationRules()); if ($validator->fails()) { return Redirect::to(route('book.create'))->withErrors($validator)->withInput(); } else { $book = new Book(); $book->title = $request->title; $book->year = $request->year; $book->genre = $request->genre; $book->author = $request->author; $book->save(); Session::flash('info', sprintf('"%s" successfully added to library', $book->title)); return Redirect::to(route('book.index')); } }