complete Complete User Request Submission section RAD-1
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Client\Auth;
|
||||
|
||||
use App\Rules\PhoneNumber;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserRegistrationRequest 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 [
|
||||
'phone' => ['required', 'string', new PhoneNumber],
|
||||
'fullname' => 'nullable|string|max:255',
|
||||
'national_code' => 'required|string|max:255',
|
||||
'specialty' => 'nullable|string|max:255',
|
||||
'clinic_name' => 'nullable|string|max:255',
|
||||
'clinic_phone' => 'nullable|string|max:255',
|
||||
'province' => 'nullable|string|max:255',
|
||||
'city' => 'nullable|string|max:255',
|
||||
'address' => 'nullable|string|max:255',
|
||||
'level' => 'nullable|string|max:50',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Client\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class VerifyOtpRequest 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 [
|
||||
'otp_code' => [
|
||||
'required',
|
||||
'numeric',
|
||||
'digits:4',
|
||||
Rule::exists('otp_codes', 'code')->where(function ($query) {
|
||||
$query->where('phone', session('login_phone'))
|
||||
->where('expires_at', '>', now());
|
||||
})
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user