app\models\LoginAttempt::isLocked PHP Method

isLocked() public static method

public static isLocked ( $ip )
    public static function isLocked($ip)
    {
        return self::where('ip', $ip)->where('failed_attempts', '>', 5)->exists();
    }

Usage Example

Example #1
0
 public function login()
 {
     $ip = Request::getClientIp();
     if (LoginAttempt::isLocked($ip)) {
         return error_popup('your IP address is locked. Please wait a few minutes.');
     } else {
         $username = Request::input('username');
         $password = Request::input('password');
         $remember = Request::input('remember') === 'yes';
         Auth::attempt(['username' => $username, 'password' => $password], $remember);
         if (Auth::check()) {
             return Auth::user()->defaultJson();
         } else {
             LoginAttempt::failedAttempt($ip, $username);
             return error_popup('wrong password or username');
         }
     }
 }
All Usage Examples Of app\models\LoginAttempt::isLocked