/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $parent_rules = parent::rules(); $my_rules = array('nombre_club' => ['required', 'unique:clubes,nombre'], 'alias' => '', 'alta' => 'date_format:d/m/Y', 'baja' => 'date_format:d/m/Y', 'estado' => '', 'persona_id' => '', 'genero_id' => ['required', 'numeric', 'in:3'], 'documento' => ['required', 'min:4'], 'tipo_doc_id' => ['required', 'numeric']); $rules = array_merge($parent_rules, $my_rules); return $rules; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $parent_rules = parent::rules(); $my_rules = array('alta' => 'date_format:d/m/Y', 'baja' => 'date_format:d/m/Y', 'about' => '', 'estado' => '', 'persona_id' => '', 'genero_id' => ['required', 'numeric', 'in:1,2'], 'nacimiento' => ['sometimes', 'date_format:d/m/Y', 'before:today'], 'documento' => ['required', 'min:4'], 'tipo_doc_id' => ['required', 'numeric']); $rules = array_merge($parent_rules, $my_rules); return $rules; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $parent_rules = parent::rules(); $regla_genero = ''; if ($this->persona->genero_id == 3) { $regla_genero = 'in:3'; } $regla_nacimiento_obligatorio = ''; if ($this->persona->esAlgo('socio')) { $regla_nacimiento_obligatorio = 'required'; } $my_rules = array('genero_id' => ['required', 'numeric', $regla_genero], 'nacimiento' => ['date_format:d/m/Y', 'before:today', $regla_nacimiento_obligatorio], 'documento' => ['required', 'min:4', 'unique_with:personas,documento,' . $this->persona->id . ',id,tipo_doc_id,' . $this->request->get('tipo_doc_id')], 'tipo_doc_id' => ['required', 'numeric', 'unique_with:personas,tipo_doc_id,' . $this->persona->id . ',id,documento,' . $this->request->get('documento')]); $rules = array_merge($parent_rules, $my_rules); return $rules; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CreatePersonaRequest $request) { $calle = new Calle(); $calle->nombre = $request->get('nombre_calle'); $calle->fill($request->all()); $calle->save(); $domicilio = new Domicilio(); $domicilio->fill($request->all()); $domicilio->calle_id = $calle->id; $domicilio->save(); $persona = new Persona(); $persona->fill($request->all()); $persona->nombre = $request->get('nombre_persona'); $persona->domicilio_id = $domicilio->id; $persona->save(); return \Redirect::route('people.personas.index'); }