/** * Store a newly created resource in storage. * * @return Response */ public function store() { $route = Route::getCurrentRoute()->getPath(); $idDep = Session::get('idDep'); $routeIdDep = str_replace('store', $idDep, $route); $input = Input::all(); $validation = Validator::make($input, Dependencia::$rules); if ($validation->passes()) { $this->dependencia->create($input); return Redirect::to($routeIdDep); } else { return Redirect::route('admin.dependencia.create')->withInput()->withErrors($validation)->with('message', 'Preencha todos os Campos!'); } }