diff --git a/app/Http/Controllers/PersonaController.php b/app/Http/Controllers/PersonaController.php index 11cf931..aa858a0 100644 --- a/app/Http/Controllers/PersonaController.php +++ b/app/Http/Controllers/PersonaController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Http\Requests\StorePersonaRequest; use App\Models\Persona; use App\Models\TipoSangre; use Illuminate\Http\Request; @@ -39,7 +40,7 @@ public function create() * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ - public function store(Request $request) + public function store(StorePersonaRequest $request) { $datos = $request->all(); Persona::create($datos); diff --git a/app/Http/Requests/StorePersonaRequest.php b/app/Http/Requests/StorePersonaRequest.php new file mode 100644 index 0000000..c88122d --- /dev/null +++ b/app/Http/Requests/StorePersonaRequest.php @@ -0,0 +1,39 @@ + + */ + public function rules() + { + return [ + 'nombre_per'=> 'required|string|max:255', + 'apellido_pa_per'=> 'required|string|max:255', + 'apellido_ma_per'=> 'required|string|max:255', + 'ci_per'=> 'required', + 'cel_per'=> 'required', + 'fecha_nac'=> 'required|date', + 'num_seguro'=> 'nullable', + 'donante'=> 'required', + 'id_tipo_sangre'=> 'required', + 'id_pariente'=>'required' + ]; + } +}