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


PHP User::create方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $username = Yii::$app->user->identity->username;
     $model = new User();
     $model->scenario = 'create';
     if (Yii::$app->request->isPost && ($model = User::create(Yii::$app->request->post()))) {
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['username' => $username, 'model' => $model]);
     }
 }
开发者ID:quyettvq,项目名称:luspel,代码行数:16,代码来源:UserController.php

示例2: newDemoUser

 /**
  * Set up a new demo user and log in.
  *
  * @return BackendAuth
  */
 protected function newDemoUser()
 {
     $demoManager = DemoManager::instance();
     $login = Str::quickRandom(Config::get('krisawzm.demomanager::username_length', 10));
     if (!$demoManager->copyTheme($login)) {
         return false;
     }
     $user = User::create(['email' => $login . '@' . $login . '.tld', 'login' => $login, 'password' => $login, 'password_confirmation' => $login, 'first_name' => ucfirst($login), 'last_name' => 'Demo', 'permissions' => $this->getPermissions(), 'is_activated' => true]);
     BackendAuth::login($user);
     UserCounter::instance()->inc();
     return $user;
 }
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:17,代码来源:DemoAuth.php

示例3: run

 public function run()
 {
     $group = UserGroup::create(['name' => 'Owners', 'code' => UserGroup::DEFAULT_CODE, 'description' => 'Default group for website owners.', 'is_new_user_default' => false]);
     $user = User::create(['email' => static::$email, 'login' => static::$login, 'password' => static::$password, 'password_confirmation' => static::$password, 'first_name' => static::$firstName, 'last_name' => static::$lastName, 'permissions' => ['superuser' => 1], 'is_activated' => true]);
     $user->addGroup($group);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:6,代码来源:SeedSetupAdmin.php

示例4: run

 public function run()
 {
     $group = UserGroup::create(['name' => 'Admins', 'code' => 'admins', 'description' => 'Default group for administrators', 'is_new_user_default' => true]);
     $user = User::create(['email' => static::$email, 'login' => static::$login, 'password' => static::$password, 'password_confirmation' => static::$password, 'first_name' => static::$firstName, 'last_name' => static::$lastName, 'permissions' => ['superuser' => 1], 'is_activated' => true]);
     $user->addGroup($group);
 }
开发者ID:idxos,项目名称:portfolio,代码行数:6,代码来源:SeedSetupAdmin.php

示例5: insertUser

 /**
  * @param array $data
  * @return int
  */
 public function insertUser($data)
 {
     $user = User::create($data);
     return $user->id;
 }
开发者ID:shina,项目名称:controntrol-my-budget-oc-backend,代码行数:9,代码来源:DataProvider.php

示例6: run

 public function run()
 {
     $group = UserGroup::create(['name' => 'Admins']);
     $user = User::create(['email' => static::$email, 'login' => static::$login, 'password' => static::$password, 'password_confirmation' => static::$password, 'first_name' => static::$firstName, 'last_name' => static::$lastName, 'permissions' => ['superuser' => 1], 'is_activated' => true]);
     $user->addGroup($group);
 }
开发者ID:360weboy,项目名称:october,代码行数:6,代码来源:SeedSetupAdmin.php


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