SUBD_Transport_Company/app/Http/Requests/UserPostRequest.php
2024-01-16 15:14:13 +04:00

30 lines
909 B
PHP

<?php
namespace App\Http\Requests;
use App\Enums\RoleEnum;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UserPostRequest extends FormRequest
{
/**
* 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|string|max:255',
'surname' => 'required|string|max:255',
'patronymic' => 'required|string|max:255',
'email' => 'required|max:255|email|lowercase',
'password' => 'required|max:255',
'role' => ['required', Rule::in(RoleEnum::getRange())],
'phone_number' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:10',
'warehouse_id' => 'required|exists:warehouses,id',
];
}
}