PATH:
home
/
rwabteecom
/
project_11
/
app
/
Services
/
Authentication
/
Editing: BaseAuthenticationService.php
<?php namespace App\Services\Authentication; use Illuminate\Auth\Events\Lockout; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Str; use Illuminate\Validation\ValidationException; abstract class BaseAuthenticationService { public function ensureIsNotRateLimited(): void { if (!RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { return; } event(new Lockout($this->request)); $seconds = RateLimiter::availableIn($this->throttleKey()); throw ValidationException::withMessages([ "auth" => trans('auth.throttle', [ 'seconds' => $seconds, "minutes" => ceil($seconds / 60) ]) ]); } public function throttleKey(): string { return Str::lower($this->request->string("phone")->toString() . "|" . $this->request->ip()); } }
SAVE
CANCEL