當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。