diff --git a/app/Http/Controllers/HistorialController.php b/app/Http/Controllers/HistorialController.php index 444dd4a..76767ea 100644 --- a/app/Http/Controllers/HistorialController.php +++ b/app/Http/Controllers/HistorialController.php @@ -8,6 +8,10 @@ use App\Models\User; use App\Models\Persona; use Illuminate\Http\Request; +use App\Http\Requests\StoreHistorialRequest; +use App\Http\Requests\EditHistorialRequest; + + class HistorialController extends Controller { @@ -32,7 +36,7 @@ public function create() //return $Users; } - public function store(Request $request) + public function store(StoreHistorialRequest $request) { // $Datos_Historia=request()->except('_token'); @@ -70,7 +74,7 @@ public function edit($Historial) } - public function update(Request $request, $historial) + public function update(EditHistorialRequest $request, $historial) { // $input = $request->all(); @@ -89,9 +93,6 @@ public function destroy( $Historial) { // Historial::destroy($Historial); - - // $Historial->delete(); - return redirect('/Historial'); } } diff --git a/app/Http/Controllers/SedeController.php b/app/Http/Controllers/SedeController.php index 5470503..89412e4 100644 --- a/app/Http/Controllers/SedeController.php +++ b/app/Http/Controllers/SedeController.php @@ -5,6 +5,9 @@ use Illuminate\Http\Request; use App\Models\Sede; +use App\Http\Requests\StoreSedeRequest; +use App\Http\Requests\EditSedeRequest; + class SedeController extends Controller { @@ -24,7 +27,7 @@ public function create() } - public function store(Request $request) + public function store(StoreSedeRequest $request) { // $Datos_Sedes=request()->except('_token'); @@ -50,7 +53,7 @@ public function edit($Id_Sede) return View ('admin.Sedes.edit',compact('Sede')); } - public function update(Request $request, $Id_Sede) + public function update(EditSedeRequest $request, $Id_Sede) { // diff --git a/app/Http/Requests/EditHistorialRequest.php b/app/Http/Requests/EditHistorialRequest.php new file mode 100644 index 0000000..5781aa7 --- /dev/null +++ b/app/Http/Requests/EditHistorialRequest.php @@ -0,0 +1,28 @@ + 'required|string|min:20|max:255', + ]; + } + public function messages() +{ + return [ + 'detalles_historial.required' => 'Es necesesario que tenga datos en estte campo', + 'detalles_historial.min' => 'Los detalles minimamente deben tener mas de 20 caracteres', + 'detalles_historial.max' => 'Los detalles no deben superar los 255 caracteres' + ]; +} +} diff --git a/app/Http/Requests/EditSedeRequest.php b/app/Http/Requests/EditSedeRequest.php new file mode 100644 index 0000000..06b1fc1 --- /dev/null +++ b/app/Http/Requests/EditSedeRequest.php @@ -0,0 +1,41 @@ + 'required|string|min:10|max:100', + 'direccion_sede' => 'required|string|min:10|max:120', + 'telefono_sede' => 'required|integer|min:8' + + ]; + } + public function messages() +{ + return [ + 'nombre_sede.required' => 'Es neceserio que este campo este llenado', + 'nombre_sede.min' => 'El nombre minimamente debe tener mas de 10 caracteres', + 'nombre_sede.max' => 'El nombre no debe superar los 120 caracteres', + + 'direccion_sede.required' => 'Es neceserio que este campo este llenado', + 'direccion_sede.min' => 'La dirrecion minimamente debe tener mas de 10 caracteres', + 'direccion_sede.max' => 'La dirrecion no debe superar los 120 caracteres', + + 'telefono_sede.required' => 'Es neceserio que este campo este llenado', + 'telefono_sede.integer' => 'Debe ser un numero no una palabra', + 'telefono_sede.min' => 'El telefono minimamente debe tener 8 numeros', + 'telefono_sede.max' => 'El telefono maximo debe tener 10 numeros' + + ]; +} +} diff --git a/app/Http/Requests/StoreHistorialRequest.php b/app/Http/Requests/StoreHistorialRequest.php new file mode 100644 index 0000000..ef931c4 --- /dev/null +++ b/app/Http/Requests/StoreHistorialRequest.php @@ -0,0 +1,29 @@ + 'required|string|min:20|max:255', + ]; + } + public function messages() +{ + return [ + 'detalles_historial.required' => 'Es necesesario que tenga datos en estte campo', + 'detalles_historial.min' => 'Los detalles minimamente deben tener mas de 20 caracteres', + 'detalles_historial.max' => 'Los detalles no deben superar los 255 caracteres' + ]; +} +} diff --git a/app/Http/Requests/StorePersonaRequest.php b/app/Http/Requests/StorePersonaRequest.php index c88122d..ce54957 100644 --- a/app/Http/Requests/StorePersonaRequest.php +++ b/app/Http/Requests/StorePersonaRequest.php @@ -6,21 +6,11 @@ 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 - */ public function rules() { return [ diff --git a/app/Http/Requests/StoreSedeRequest.php b/app/Http/Requests/StoreSedeRequest.php index 39ea6ca..936c0e6 100644 --- a/app/Http/Requests/StoreSedeRequest.php +++ b/app/Http/Requests/StoreSedeRequest.php @@ -3,28 +3,41 @@ namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; - +use Illuminate\Http\Request; class StoreSedeRequest 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 - */ public function rules() { return [ - // + 'nombre_sede' => 'required|string|min:10|max:100', + 'direccion_sede' => 'required|string|min:10|max:120', + 'telefono_sede' => 'required|integer|min:8' + ]; } + public function messages() +{ + return [ + 'nombre_sede.required' => 'Es neceserio que este campo este llenado', + 'nombre_sede.min' => 'El nombre minimamente debe tener mas de 10 caracteres', + 'nombre_sede.max' => 'El nombre no debe superar los 120 caracteres', + + 'direccion_sede.required' => 'Es neceserio que este campo este llenado', + 'direccion_sede.min' => 'La dirrecion minimamente debe tener mas de 10 caracteres', + 'direccion_sede.max' => 'La dirrecion no debe superar los 120 caracteres', + + 'telefono_sede.required' => 'Es neceserio que este campo este llenado', + 'telefono_sede.integer' => 'Debe ser un numero no una palabra', + 'telefono_sede.min' => 'El telefono minimamente debe tener 8 numeros', + 'telefono_sede.max' => 'El telefono maximo debe tener 10 numeros' + + ]; } +} + diff --git a/resources/views/admin/Historial/create.blade.php b/resources/views/admin/Historial/create.blade.php index d00ca50..b05d532 100644 --- a/resources/views/admin/Historial/create.blade.php +++ b/resources/views/admin/Historial/create.blade.php @@ -47,12 +47,17 @@
-
+

-
+ + @error('detalles_historial') +
  • {{$message}}

  • + @enderror +
    -
    + +
    diff --git a/resources/views/admin/Historial/edit.blade.php b/resources/views/admin/Historial/edit.blade.php index 1fa554b..977d5be 100644 --- a/resources/views/admin/Historial/edit.blade.php +++ b/resources/views/admin/Historial/edit.blade.php @@ -52,12 +52,17 @@
    -
    +

    -
    + + @error('detalles_historial') +
  • {{$message}}

  • + @enderror -
    +
    + +
    diff --git a/resources/views/admin/Sedes/create.blade.php b/resources/views/admin/Sedes/create.blade.php index 10a42f3..3170713 100644 --- a/resources/views/admin/Sedes/create.blade.php +++ b/resources/views/admin/Sedes/create.blade.php @@ -6,11 +6,24 @@
    {!! csrf_field() !!}
    -
    + + @error('nombre_sede') +
  • {{$message}}
  • + @enderror + +

    -
    + + @error('direccion_sede') +
  • {{$message}}
  • + @enderror + +

    -
    + + @error('telefono_sede') +
  • {{$message}}
  • + @enderror


    -
    + + @error('nombre_sede') +
  • {{$message}}
  • + @enderror

    -
    + + @error('direccion_sede') +
  • {{$message}}
  • + @enderror

    -
    + + @error('telefono_sede') +
  • {{$message}}
  • + @enderror + +