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