Files
radicall/app/Http/Requests/Client/Auth/VerifyOtpRequest.php
T

38 lines
960 B
PHP

<?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());
})
]
];
}
}