/** * Deletes an existing User model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = $this->findModel(User::className(), $id); self::checkAccess(RbacController::delete_profile, ['user' => $model]); $model->delete(); return $this->redirect(['list']); }
/** * @return \yii\db\ActiveQuery */ public function getLastReplyUser() { if (empty($this->last_reply_user)) { return null; } return $this->hasOne(User::className(), ['username' => 'last_reply_user']); }
public function getUser() { if ($this->_user === null) { $this->_user = Yii::createObject(User::className()); } return $this->_user; }
public function rules() { return [[['phone', 'email', 'password'], 'filter', 'filter' => 'trim'], [['phone', 'email', 'password'], 'required', 'on' => 'default'], [['phone', 'email'], 'required', 'on' => 'phoneAndEmailFinish'], [['phone'], 'required', 'on' => 'phoneFinish'], ['password', 'string', 'min' => 6, 'max' => 255], ['phone', 'unique', 'targetClass' => User::className(), 'message' => 'Этот номер уже занят.'], ['phone', function ($attribute, $params) { $this->phone = str_replace('_', '', $this->phone); if (iconv_strlen($this->phone) != 16) { $this->addError($attribute, 'Пример: 7 (XXX) XXX-XXXX'); } }], ['email', 'email'], ['email', 'unique', 'targetClass' => User::className(), 'message' => 'Эта почта уже занята.'], ['status', 'default', 'value' => User::STATUS_ACTIVE, 'on' => 'default'], ['status', 'in', 'range' => [User::STATUS_NOT_ACTIVE, User::STATUS_ACTIVE]], ['status', 'default', 'value' => User::STATUS_NOT_ACTIVE, 'on' => 'emailActivation']]; }
/** * @inheritdoc */ public function rules() { return [['username', 'filter', 'filter' => 'trim'], ['username', 'required'], ['username', 'unique', 'targetClass' => User::className(), 'filter' => function ($query) { if (!$this->getModel()->isNewRecord) { $query->andWhere(['not', ['id' => $this->getModel()->id]]); } }], ['username', 'string', 'min' => 2, 'max' => 255], ['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => User::className(), 'filter' => function ($query) { if (!$this->getModel()->isNewRecord) { $query->andWhere(['not', ['id' => $this->getModel()->id]]); } }], ['password', 'required', 'on' => 'create'], ['password', 'string', 'min' => 6], [['status'], 'integer'], [['roles'], 'each', 'rule' => ['in', 'range' => ArrayHelper::getColumn(\Yii::$app->authManager->getRoles(), 'name')]]]; }
/** * 用户登录 */ public function actionLogin() { if (!Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $model->userClass = User::className(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goHome(); } else { return $this->renderPartial('login', ['model' => $model]); } }
/** * @inheritdoc */ public function getAuthor() { return $this->hasOne(\common\models\User::className(), ['id' => 'author_id']); }
/** * @return \yii\db\ActiveQuery */ public function getPostAuthor() { return $this->hasOne(User::className(), ['id' => 'post_author']); }
public function getUsers() { return $this->hasMany(User::className(), ['estado_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getUserRelease() { return $this->hasOne(User::className(), ['id' => 'user_release']); }
/** * @return \yii\db\ActiveQuery */ public function getSender0() { return $this->hasOne(User::className(), ['id' => 'sender']); }
public function getAnggota() { return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']); }
echo Url::to(['report/index']); ?> "> Go to Graphic <i class="fa fa-arrow-circle-right"></i> </a> </div> </div><!-- ./col --> </div> <hr> <div class="row"> <!-- Left col --> <section class="col-lg-9 connectedSortable ui-sortable"> <!-- Chat box --> <?php echo \sintret\chat\ChatRoom::widget(['url' => Url::to(['/ajax/send-chat']), 'userModel' => \common\models\User::className(), 'userField' => 'avatarImage']); ?> <!-- To Do List --> <?php echo \sintret\todolist\ListView::widget(['url' => Url::to(['/ajax/todolist'])]); ?> </section><!-- /.Left col --> <div class="col-md-3"> <?php $phone = []; $users = common\models\User::find()->where(['status' => common\models\User::STATUS_ACTIVE])->all(); if ($users) { foreach ($users as $user) { if ($user->phone) { $invite[] = "{ id : '{$user->phone}', invite_type : 'PHONE' }";
/** * Возвращает автора статьи * @return \common\models\User */ public function getUser() { return $this->hasOne(User::className(), ['id' => 'created_by']); }
/** * @return \yii\db\ActiveQuery */ public function getIdUserCreate() { return $this->hasOne(User::className(), ['id' => 'id_user_create']); }
/** * @inheritdoc */ public function rules() { return [[['email', 'captcha'], 'trim'], [['email', 'captcha'], 'required'], ['email', 'email'], ['email', 'exist', 'targetClass' => User::className(), 'filter' => ['status' => User::STATUS_ACTIVE], 'message' => '未找到使用该邮箱的用户!'], [['captcha'], 'captcha', 'captchaAction' => 'site/password-reset-captcha']]; }
/** * @return \yii\db\ActiveQuery */ public function getLikedOrDislikedBy0() { return $this->hasOne(User::className(), ['id' => 'likedOrDislikedBy']); }
public function getAuthor() { return $this->hasOne(User::className(), ['id' => 'author_id'])->select('id,username,icon'); }
public function getUser() { return $this->hasOne(User::className(), ['id' => 'submitter']); }
/** * @return string */ public function getUserClass() { if (!$this->_userClass) { $this->_userClass = $this->client_id === Client::MASTER_ID ? Tech::className() : User::className(); } return $this->_userClass; }
/** * @return \yii\db\ActiveQuery */ public function getPi() { return $this->hasOne(User::className(), ['id' => 'pi_id']); }
/** * @return \yii\db\ActiveQuery */ public function getAuthors() { return $this->hasOne(User::className(), ['ID' => 'author']); //bizdeki bir kayıt 1 kayıta denk geliyor ilişkiler }
/** * @return \yii\db\ActiveQuery */ public function getIdrelevadors() { return $this->hasMany(User::className(), ['id' => 'idrelevador'])->viaTable('ruta_relevador', ['idruta' => 'id']); }
public function getEditor() { return $this->hasOne(User::className(), ['id' => 'editor']); }
public function getUser() { //同样第一个参数指定关联的子表模型类名 // return $this->hasOne(User::className(), ['user_id' => 'publis_user_id']); }
public function getUserEgreso() { return $this->hasOne(\common\models\User::className(), ['id' => 'egr_id_user'])->from(\common\models\User::tableName() . ' uegr'); }
/** * @return \yii\db\ActiveQuery */ public function getUpdatedBy() { return $this->hasOne(User::className(), ['id' => 'updated_by']); }
public function getUserUpdatedBy() { return $this->hasOne(\common\models\User::className(), ['id' => 'updated_by']); }
/** * @return ActiveQuery */ public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); }
/** * @return \yii\db\ActiveQuery */ public function getMediaAuthor() { return $this->hasOne(User::className(), ['id' => 'media_author']); }