コード例 #1
0
 public function actionLogout()
 {
     if (isset(Yii::$app->user->id)) {
         \app\models\LoginDetails::updateAll(['login_status' => 0, 'logout_at' => new \yii\db\Expression('NOW()')], 'login_user_id=' . Yii::$app->user->id . ' AND login_status = 1');
     }
     Yii::$app->user->logout();
     return $this->goHome();
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = LoginDetails::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['login_detail_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['login_detail_id' => $this->login_detail_id, 'login_user_id' => $this->login_user_id, 'login_status' => $this->login_status, 'login_at' => $this->login_at, 'logout_at' => $this->logout_at]);
     $query->andFilterWhere(['like', 'user_ip_address', $this->user_ip_address]);
     return $dataProvider;
 }
コード例 #3
0
 /**
  * Finds the LoginDetails model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return LoginDetails the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = LoginDetails::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
ファイル: User.php プロジェクト: aoopvn/EduSec4.0.0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLoginDetails()
 {
     return $this->hasMany(LoginDetails::className(), ['login_user_id' => 'user_id']);
 }
コード例 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCoordinator0()
 {
     return $this->hasOne(LoginDetails::className(), ['id' => 'coordinator']);
 }
コード例 #6
0
ファイル: UserLoginLog.php プロジェクト: navchahal2u/glsproj
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(LoginDetails::className(), ['id' => 'userId']);
 }
コード例 #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReceivedBy()
 {
     return $this->hasOne(LoginDetails::className(), ['id' => 'received_by']);
 }