本文整理汇总了PHP中common\models\User::className方法的典型用法代码示例。如果您正苦于以下问题:PHP User::className方法的具体用法?PHP User::className怎么用?PHP User::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\User
的用法示例。
在下文中一共展示了User::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDelete
/**
* 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']);
}
示例2: getLastReplyUser
/**
* @return \yii\db\ActiveQuery
*/
public function getLastReplyUser()
{
if (empty($this->last_reply_user)) {
return null;
}
return $this->hasOne(User::className(), ['username' => 'last_reply_user']);
}
示例3: getUser
public function getUser()
{
if ($this->_user === null) {
$this->_user = Yii::createObject(User::className());
}
return $this->_user;
}
示例4: rules
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']];
}
示例5: rules
/**
* @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')]]];
}
示例6: actionLogin
/**
* 用户登录
*/
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]);
}
}
示例7: getAuthor
/**
* @inheritdoc
*/
public function getAuthor()
{
return $this->hasOne(\common\models\User::className(), ['id' => 'author_id']);
}
示例8: getPostAuthor
/**
* @return \yii\db\ActiveQuery
*/
public function getPostAuthor()
{
return $this->hasOne(User::className(), ['id' => 'post_author']);
}
示例9: getUsers
public function getUsers()
{
return $this->hasMany(User::className(), ['estado_id' => 'id']);
}
示例10: getUserRelease
/**
* @return \yii\db\ActiveQuery
*/
public function getUserRelease()
{
return $this->hasOne(User::className(), ['id' => 'user_release']);
}
示例11: getSender0
/**
* @return \yii\db\ActiveQuery
*/
public function getSender0()
{
return $this->hasOne(User::className(), ['id' => 'sender']);
}
示例12: getAnggota
public function getAnggota()
{
return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
}
示例13: foreach
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' }";
示例14: getUser
/**
* Возвращает автора статьи
* @return \common\models\User
*/
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'created_by']);
}
示例15: getIdUserCreate
/**
* @return \yii\db\ActiveQuery
*/
public function getIdUserCreate()
{
return $this->hasOne(User::className(), ['id' => 'id_user_create']);
}