/** * Store a newly created resource in storage. * * @return Response */ public function store() { //$route = Route::getCurrentRoute()->getPath(); $input = Input::all(); $validation = Validator::make($input, Disciplina::$rules); if ($validation->passes()) { $check = Disciplina::where('id_ccr_dis', Input::get('id_ccr_dis'))->get(); if (count($check) > 0) { Session::flash('warning', 'Disciplina já cadastrada!'); return Redirect::route('admin.disciplina.index'); } else { $this->disciplina->create($input); Session::flash('message', 'Disciplina cadastrada com sucesso!'); return Redirect::route('admin.disciplina.index'); } } return Redirect::route('admin.disciplina.index')->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }