Register page should work
This commit is contained in:
25
app/Rules/PhoneCodeVerification.php
Normal file
25
app/Rules/PhoneCodeVerification.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class PhoneCodeVerification implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
$verification = Verification::where('username', auth()->user()->phone)
|
||||
->where('code', $request->verification_code)
|
||||
->first();
|
||||
|
||||
if (! $verification) {
|
||||
$fail(__('Write a correct data please'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user