Commit 457af72f authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Validar request para crear el usuario

parent 67f3d99f
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'name' => 'required|regex:/\w*$/|string|min:1|max:255',
            'username' => 'required|string|regex:/\w*$/|max:255|unique:users,username',
            'password' => 'required|regex:/\w*$/|string|min:8|max:255|confirmed',
            'dependencia_id' => 'required|min:1|integer',
        ];
    }
}