Files
portal-api/app/Http/Requests/User/UserRegisterRequest.php
T
2025-07-24 16:18:27 +07:00

54 lines
1.5 KiB
PHP

<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UserRegisterRequest 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 [
'email' => 'required|email|unique:customer',
'firstname' => 'required',
'lastname' => 'required',
'password' => 'required|min:8',
'phone' => 'required|unique:customer'
];
}
public function messages()
{
return [
'email' => [
'required' => 'Vui lòng nhập địa chỉ email',
'email' => 'Địa chỉ email không hợp lệ',
'unique' => 'Email này đã tồn tại'
],
'firstname.required' => 'Vui lòng nhập tên của bạn',
'lastname.required' => 'Vui lòng nhập họ của bạn',
'password' => [
'required' => 'Mật khẩu không được để trống',
'min' => 'Mật khẩu tối thiểu 8 ký tự'
],
'phone' => [
'required' => 'Số điện thoại là bắt buộc',
'unique' => 'Số điện thoại đã tồn tại'
]
];
}
}