client api
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Client;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ClientRegisterRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Allow request
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'fullname' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255'
|
||||
],
|
||||
'phone' => [
|
||||
'required',
|
||||
'digits:10',
|
||||
'unique:customers,phone'
|
||||
],
|
||||
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'max:255',
|
||||
'unique:customers,email'
|
||||
],
|
||||
|
||||
'password' => [
|
||||
'required',
|
||||
'string',
|
||||
'min:6',
|
||||
'confirmed'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom messages
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'fullname.required' => 'Tên là bắt buộc',
|
||||
'phone.required' => 'Số điện thoại là bắt buộc',
|
||||
'phone.digits' => 'Số điện thoại phải có 10 chữ số',
|
||||
'phone.unique' => 'Số điện thoại đã tồn tại',
|
||||
'email.required' => 'Email là bắt buộc',
|
||||
'email.email' => 'Email không đúng định dạng',
|
||||
'email.unique' => 'Email đã tồn tại',
|
||||
|
||||
'password.required' => 'Mật khẩu là bắt buộc',
|
||||
'password.min' => 'Mật khẩu tối thiểu 6 ký tự',
|
||||
'password.confirmed' => 'Xác nhận mật khẩu không khớp',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user