app\models\LoginAttempt::isLocked PHP 메소드

isLocked() 공개 정적인 메소드

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

Usage 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