Пример #1
0
 public static function isertar($input)
 {
     $respuesta = [];
     $reglas = ['dni' => array('required', 'min:8', 'max:8'), 'nombre' => array('required'), 'apellidos' => array('required'), 'edad' => array('required')];
     $validador = Validator::make($input, $reglas);
     if ($validador->fails()) {
         $respuesta['mensaje'] = $validador;
         $respuesta['error'] = true;
     } else {
         $newarbitro = new Arbitro();
         $newarbitro->dni = Input::get('dni');
         $newarbitro->nombre = Input::get('nombre');
         $newarbitro->Apellidos = Input::get('apellidos');
         $newarbitro->edad = Input::get('edad');
         $newarbitro->save();
         $respuesta['mensaje'] = 'Datos insertados correctamente';
         $respuesta['error'] = false;
     }
     return $respuesta;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $arbitro = new Arbitro();
     $arbitro->dni = Input::get('DNI');
     $arbitro->nombre = Input::get('Nombre');
     $arbitro->categoria = Input::get('Categoria');
     $arbitro->idarbitropartido = Input::get('ID');
     $arbitro->save();
     return Redirect::to('arbitros/listar');
 }