protected static function createHistoryEntry($state, $userId) { $history = new UserLoginHistory(); $history->state = $state; $history->user_id = $userId; $history->ip = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR'); $history->save(); }
/** @inheritdoc */ protected function createHistoryEntry($success) { $loginHistory = \Yii::createObject(['class' => UserLoginHistory::className(), 'user_id' => $this->user->id, 'login_ip' => \Yii::$app->request->userIP, 'platform' => '', 'browser' => '', 'failed_attempts' => $success ? 0 : 1, 'success' => $success]); $loginHistory->save(false); }