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


PHP User::className方法代码示例

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


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

示例1: register

 /**
  * Registers a new user account. If registration was successful it will set flash message.
  *
  * @return bool
  */
 public function register()
 {
     if (!$this->validate()) {
         return false;
     }
     /** @var User $user */
     $user = Yii::createObject(User::className());
     $user->setScenario('register');
     $this->loadAttributes($user);
     if (!$user->register()) {
         return false;
     }
     Yii::$app->session->setFlash('info', Yii::t('user', 'Your account has been created and a message with further instructions has been sent to your email'));
     return true;
 }
开发者ID:apmauj,项目名称:1f8bf10ab74d6f5ca69f7c07b7ee1c38,代码行数:20,代码来源:RegistrationForm.php

示例2: actionConnect

 /**
  * Displays page where user can create new account that will be connected to social account.
  *
  * @param string $code
  *
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionConnect($code)
 {
     $account = $this->finder->findAccount()->byCode($code)->one();
     if ($account === null || $account->getIsConnected()) {
         throw new NotFoundHttpException();
     }
     /** @var User $user */
     $user = Yii::createObject(['class' => User::className(), 'scenario' => 'connect', 'username' => $account->username, 'email' => $account->email]);
     if ($user->load(Yii::$app->request->post()) && $user->create()) {
         $account->connect($user);
         return $this->render('/message', ['title' => Yii::t('user', 'Your account has been created'), 'module' => $this->module]);
         //            Yii::$app->user->login($user, $this->module->rememberFor);
         //            return $this->goBack();
     }
     return $this->render('connect', ['model' => $user, 'account' => $account]);
 }
开发者ID:apmauj,项目名称:1f8bf10ab74d6f5ca69f7c07b7ee1c38,代码行数:24,代码来源:RegistroController.php

示例3: actionCreate

 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $user = Yii::createObject(['class' => User::className(), 'scenario' => 'create']);
     if ($user->load(Yii::$app->request->post())) {
         /*            $coordenadas = sysconfigs::getCoordinates($user->direccion);
                     $user->latitud = $coordenadas['latitud'];
                     $user->longitud = $coordenadas['longitud'];*/
         //generamos password
         $user->password = $user->password == null ? Password::generate(8) : $user->password;
         if ($user->save()) {
             $user->mailer->sendWelcomeMessage($user, null);
             return $this->redirect(['update', 'id' => $user->id]);
         } else {
             return $this->render('create', ['user' => $user]);
         }
     } else {
         return $this->render('create', ['user' => $user]);
     }
 }
开发者ID:apmauj,项目名称:1f8bf10ab74d6f5ca69f7c07b7ee1c38,代码行数:24,代码来源:AdminController.php

示例4: rules

 public function rules()
 {
     return [[['username', 'email', 'password'], 'filter', 'filter' => 'trim'], [['username', 'email', 'password'], 'required'], ['username', 'string', 'min' => 2, 'max' => 255], ['password', 'string', 'min' => 6, 'max' => 255], ['username', 'unique', 'targetClass' => User::className(), 'message' => 'Это имя уже занято.'], ['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]]];
 }
开发者ID:GalkinDmitriy,项目名称:evalotta,代码行数:4,代码来源:RegForm.php

示例5: getUser

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

示例6: getUser

 public function getUser()
 {
     return $this->hasMany(User::className(), ['level_id' => 'level_id']);
 }
开发者ID:rxz135cc,项目名称:yii2webApp,代码行数:4,代码来源:Level.php

示例7: dirname

<?php

use backend\models\User;
$params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php');
return ['id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'aliases' => ['@file_view_dir' => '@backend/files'], 'bootstrap' => ['log'], 'modules' => [], 'components' => ['user' => ['identityClass' => User::className(), 'enableAutoLogin' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error']], 'params' => $params];
开发者ID:brygom,项目名称:yii2-advanced-template-rbac,代码行数:5,代码来源:backend.php

示例8: getAuthor

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

示例9: getUsers

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

示例10: getUsers

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

示例11: getAddress

 public function getAddress()
 {
     return $this->hasOne(User::className(), ['id' => 'addressId']);
 }
开发者ID:jaybril,项目名称:www.mimgpotea.com,代码行数:4,代码来源:Order.php

示例12: getIdUsuario

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

示例13: getCreatedBy

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCreatedBy()
 {
     return $this->hasOne(User::className(), ['id' => 'created_by']);
 }
开发者ID:vihanga-liyanage,项目名称:feed-cloud,代码行数:7,代码来源:Module.php

示例14: getUsername0

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

示例15: getUsers

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


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