public function submit_create_programacion_reporte_cn() { if (Auth::check()) { $data["inside_url"] = Config::get('app.inside_url'); $data["user"] = Session::get('user'); // Verifico si el usuario es un Webmaster if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2) { // Validate the info, create rules for the inputs $attributes = array('idtipo_reporte_cn' => 'Tipo de Reporte', 'idarea_cn' => 'Departamento', 'fecha_cn' => 'Fecha de Presentación', 'nombre_cn' => 'Nombre de Reporte', 'num_doc_responsable_cn' => 'N° Documento Responsable'); $messages = array(); $rules = array('idtipo_reporte_cn' => 'required', 'idarea_cn' => 'required', 'fecha_cn' => 'required', 'nombre_cn' => 'required', 'num_doc_responsable_cn' => 'required'); // Run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules, $messages, $attributes); // If the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to('programacion_reportes/create_programacion_reportes')->withErrors($validator)->withInput(Input::all()); } else { $programacion_reporte_cn = new ProgramacionReporteCN(); $programacion_reporte_cn->idtipo_reporte_CN = Input::get('idtipo_reporte_cn'); $programacion_reporte_cn->idservicio = Input::get('idservicio_cn'); $programacion_reporte_cn->iduser = Input::get('idresponsable_cn'); $programacion_reporte_cn->idarea = Input::get('idarea_cn'); $programacion_reporte_cn->fecha = date("Y-m-d", strtotime(Input::get('fecha_cn'))); $programacion_reporte_cn->nombre_reporte = Input::get('nombre_cn'); $programacion_reporte_cn->idestado_programacion_reportes = 1; $programacion_reporte_cn->save(); Session::flash('message', 'Se registró correctamente la programación de Reporte de Necesidad.'); return Redirect::to('programacion_reportes/create_programacion_reportes'); } } else { return View::make('error/error', $data); } } else { return View::make('error/error', $data); } }