public function store(AuthorRequest $request) { $author = Author::create($request->all()); session()->flash('flash_message', 'Author was stored with success'); if (Request::wantsJson()) { return $author; } return redirect('authors'); }