Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
protovalidaciones
Browse files Browse the repository at this point in the history
  • Loading branch information
rats4final committed Nov 24, 2022
1 parent 5ef6539 commit e07c575
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Controllers/PersonaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
39 changes: 39 additions & 0 deletions app/Http/Requests/StorePersonaRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StorePersonaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
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'
];
}
}

0 comments on commit e07c575

Please sign in to comment.