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


PHP Users::className方法代码示例

本文整理汇总了PHP中app\models\Users::className方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::className方法的具体用法?PHP Users::className怎么用?PHP Users::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Users的用法示例。


在下文中一共展示了Users::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     $model->setScenario('register');
     $post = Yii::$app->request->post();
     $formName = basename($model->className());
     if ($model->load($post)) {
         // Default value
         $model->is_super_admin = isset($post[$formName]['is_super_admin']) ? $post[$formName]['is_super_admin'] : 0;
         $model->role = $model->is_super_admin ? Identity::ROLE_SUPERADMIN : 30;
         $model->fecha_conexion = isset($post[$formName]['fecha_conexion']) ? $post[$formName]['fecha_conexion'] : Yii::$app->fn->GetDate('none');
         $model->fecha_modif = isset($post[$formName]['fecha_modif']) ? $post[$formName]['fecha_modif'] : Yii::$app->fn->GetDate('none');
         $model->fecha_registro = isset($post[$formName]['fecha_registro']) ? $post[$formName]['fecha_registro'] : Yii::$app->fn->GetDate();
         $model->id_estado = isset($post[$formName]['id_estado']) ? $post[$formName]['id_estado'] : 1;
         if ($model->validate()) {
             $model->setPassword();
             $model->generateAuthKey();
             if ($model->save()) {
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         }
     }
     // Load empty/error form
     return $this->render('create', ['model' => $model]);
 }
开发者ID:juanchi008,项目名称:playa_auto,代码行数:30,代码来源:UsersController.php

示例2: rules

 public function rules()
 {
     /*$rules = parent::rules();
       $rules[] = ['captcha','required'];
       $rules[] = ['captcha','captcha'];*/
     return [[['login', 'email', 'password', 'family', 'name', 'captcha'], 'required'], [['login', 'family', 'name', 'father', 'email', 'phone'], 'filter', 'filter' => 'trim'], ['email', 'email'], ['captcha', 'captcha'], [['login', 'family', 'name'], 'string', 'min' => 3, 'max' => 255], ['password', 'string', 'min' => 6, 'max' => 255], ['login', 'unique', 'targetClass' => Users::className(), 'message' => 'Этот логин уже зарегистрирован'], ['email', 'unique', 'targetClass' => Users::className(), 'message' => 'Эта почта уже зарегистрирована'], ['phone', 'unique', 'targetClass' => Users::className(), 'message' => 'Этот телефон уже зарегистрирован']];
 }
开发者ID:pozdny,项目名称:hunter.dev,代码行数:7,代码来源:RegForm.php

示例3: getUsers

 public function getUsers()
 {
     return $this->hasMany(Users::className(), ['id' => 'user_id'])->via('userBindings');
 }
开发者ID:DezMonT765,项目名称:beacon-cms,代码行数:4,代码来源:Groups.php

示例4: getModified

 public function getModified()
 {
     return $this->hasOne(Users::className(), ['id' => 'modified_by']);
 }
开发者ID:damisadam,项目名称:FMS,代码行数:4,代码来源:Country.php

示例5: getUser

 public function getUser()
 {
     return $this->hasOne(Users::className(), ["id" => "user_id"]);
 }
开发者ID:yogamaya,项目名称:Checksystem,代码行数:4,代码来源:AcceptedRequests.php

示例6: rules

 public function rules()
 {
     return [[['name', 'email', 'password'], 'filter', 'filter' => 'trim'], [['name', 'email', 'password'], 'required'], ['name', 'string', 'min' => 2, 'max' => 255], ['password', 'string', 'min' => 6, 'max' => 255], ['name', 'unique', 'targetClass' => Users::className(), 'message' => 'это имя занято'], [['email'], 'email'], ['email', 'unique', 'targetClass' => Users::className(), 'message' => 'Почта зарегистрирована'], ['status', 'default', 'value' => Users::STATUS_ACTIVE, 'on' => 'default'], ['status', 'in', 'range' => [Users::STATUS_NOT_ACTIVE, Users::STATUS_ACTIVE]], ['password', 'required', 'on' => 'create']];
 }
开发者ID:shapik2004,项目名称:artem,代码行数:4,代码来源:UserForm.php

示例7: getAuthor

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAuthor()
 {
     return $this->hasOne(Users::className(), ['user_id' => 'author_id']);
 }
开发者ID:Michelee,项目名称:Yii,代码行数:7,代码来源:Posts.php

示例8: getUsers

 public function getUsers()
 {
     return $this->hasMany(Users::className(), ['id_user' => 'client', 'manager' => 'id_user']);
 }
开发者ID:underpantsGnomes,项目名称:test,代码行数:4,代码来源:SuperPremium.php

示例9: getProfile

 public function getProfile()
 {
     return $this->hasOne(Users::className(), ['id' => 'author']);
 }
开发者ID:developer-home,项目名称:project777,代码行数:4,代码来源:Comments.php

示例10: getUsers

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsers()
 {
     return $this->hasMany(Users::className(), ['UserTypeID' => 'UserTypeID']);
 }
开发者ID:raguila,项目名称:islc,代码行数:7,代码来源:UserType.php

示例11: actions

 public function actions()
 {
     return ['ajax-update' => ['class' => UserEditableAction::className(), 'modelClass' => Users::className(), 'forceCreate' => false]];
 }
开发者ID:DezMonT765,项目名称:beacon-cms,代码行数:4,代码来源:UserController.php

示例12: getUsers

 public function getUsers()
 {
     return $this->hasOne(Users::className(), ['id' => 'user_id'])->viaTable('user_networks', ['id' => 'user_networks_id']);
 }
开发者ID:egrubbi,项目名称:project,代码行数:4,代码来源:News.php

示例13: getUsers

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsers()
 {
     return $this->hasMany(Users::className(), ['id' => 'user_id'])->viaTable('users_roles', ['itemname' => 'name']);
 }
开发者ID:ArseniyDyupin,项目名称:SimpleCRM,代码行数:7,代码来源:MainRoles.php

示例14: getUsers

 public function getUsers()
 {
     return $this->hasOne(\app\models\Users::className(), ['id' => 'FK_organizer_id']);
 }
开发者ID:sergpost3,项目名称:hackaton,代码行数:4,代码来源:Events.php

示例15: getUserssolved

 public function getUserssolved()
 {
     return $this->hasMany(Users::className(), ['task_id', 'user_id'])->via('accepted_requests');
 }
开发者ID:yogamaya,项目名称:Checksystem,代码行数:4,代码来源:Tasks.php


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