当前位置: 首页>>代码示例>>PHP>>正文


PHP User::className方法代码示例

本文整理汇总了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']);
 }
开发者ID:brygom,项目名称:yii2-advanced-template-rbac,代码行数:13,代码来源:UserController.php

示例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']);
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:10,代码来源:Topic.php

示例3: getUser

 public function getUser()
 {
     if ($this->_user === null) {
         $this->_user = Yii::createObject(User::className());
     }
     return $this->_user;
 }
开发者ID:su-xiaolin,项目名称:ICShop-Yii,代码行数:7,代码来源:RegisterForm.php

示例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']];
 }
开发者ID:baranov-nt,项目名称:some-2,代码行数:9,代码来源:RegForm.php

示例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')]]];
 }
开发者ID:rafalsky,项目名称:home-finance,代码行数:15,代码来源:UserForm.php

示例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]);
     }
 }
开发者ID:phpdn,项目名称:qc-base,代码行数:16,代码来源:PassportController.php

示例7: getAuthor

 /**
  * @inheritdoc
  */
 public function getAuthor()
 {
     return $this->hasOne(\common\models\User::className(), ['id' => 'author_id']);
 }
开发者ID:chameleon82,项目名称:yiindo,代码行数:7,代码来源:Catalog.php

示例8: getPostAuthor

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPostAuthor()
 {
     return $this->hasOne(User::className(), ['id' => 'post_author']);
 }
开发者ID:pramana08,项目名称:app-cms,代码行数:7,代码来源:Post.php

示例9: getUsers

 public function getUsers()
 {
     return $this->hasMany(User::className(), ['estado_id' => 'id']);
 }
开发者ID:pacovalls,项目名称:contafamily2,代码行数:4,代码来源:Estado.php

示例10: getUserRelease

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserRelease()
 {
     return $this->hasOne(User::className(), ['id' => 'user_release']);
 }
开发者ID:seans888,项目名称:PROJ-BIR-TRACK,代码行数:7,代码来源:Docworkflow.php

示例11: getSender0

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSender0()
 {
     return $this->hasOne(User::className(), ['id' => 'sender']);
 }
开发者ID:bokko79,项目名称:servicemapp,代码行数:7,代码来源:Messages.php

示例12: getAnggota

 public function getAnggota()
 {
     return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
 }
开发者ID:jigunk,项目名称:yudisium,代码行数:4,代码来源:Penilaian.php

示例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' }";
开发者ID:sintret,项目名称:yii2-advanced,代码行数:31,代码来源:index.php

示例14: getUser

 /**
  * Возвращает автора статьи
  * @return \common\models\User
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'created_by']);
 }
开发者ID:heartshare,项目名称:yii2-content-module,代码行数:8,代码来源:Content.php

示例15: getIdUserCreate

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdUserCreate()
 {
     return $this->hasOne(User::className(), ['id' => 'id_user_create']);
 }
开发者ID:phpsong,项目名称:ExtJS5-Yii2,代码行数:7,代码来源:Enterprise.php


注:本文中的common\models\User::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。