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


PHP User::create方法代码示例

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


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

示例1: test_bouncer_can_fill_an_ability_model

 public function test_bouncer_can_fill_an_ability_model()
 {
     $bouncer = $this->bouncer($user = User::create());
     $ability = $bouncer->ability(['name' => 'test-ability']);
     $this->assertInstanceOf(Ability::class, $ability);
     $this->assertEquals('test-ability', $ability->name);
 }
开发者ID:jmadden,项目名称:bouncer,代码行数:7,代码来源:BouncerSimpleTest.php

示例2: store

 /**
  * Store a newly created user in storage.
  *
  * @return Response
  */
 public function store()
 {
     app('Pingpong\\Admin\\Validation\\User\\Create')->validate($data = $this->inputAll());
     $user = $this->users->create($data);
     $user->addRole(\Input::get('role'));
     return $this->redirect('users.index');
 }
开发者ID:arwinjp,项目名称:ODTS,代码行数:12,代码来源:UsersController.php

示例3: register

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function register()
 {
     $input = Input::all();
     $validation = Validator::make($input, User::$rules);
     //	dd($input);
     Log::info($input);
     if ($validation->passes()) {
         $input['password'] = Hash::make($input['password']);
         $result = $this->user->create($input);
         $data = ['patient_id' => $result->id];
         $data['patient_information_id'] = $this->patientinformation->create($data)->id;
         $this->medicalrecord->create($data);
         //	return Redirect::route('users.index');
         $data['message'] = "User successfully registered. Please login to continue.";
         $data['error'] = false;
         return $data;
     }
     $mess = "";
     $messages = $validation->messages();
     foreach ($messages->all() as $message) {
         $mess .= $message;
     }
     $output = array('error' => true, 'message' => $mess);
     return $output;
     /*
     		return Redirect::route('users.create')
     ->withInput()
     ->withErrors($validation)
     ->with('message', 'There were validation errors.');
     */
 }
开发者ID:achyut,项目名称:Medico-backend,代码行数:36,代码来源:AuthController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, User::$rules);
     if ($validation->passes()) {
         $input['password'] = Hash::make(Input::get('password'));
         $this->user->create($input);
         return Redirect::route('users.index');
     }
     return Redirect::route('users.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
开发者ID:hendryguna,项目名称:laravel-basic,代码行数:16,代码来源:UsersController.php

示例5: createArticle

 function createArticle()
 {
     $user = new User($this->mySQL);
     $news_item = $this->mySQL['r']->query("SELECT * FROM `news_articles` WHERE `ID`='" . $this->articleID . "'");
     $news = array();
     if ($news_item !== false && $news_item->num_rows != 0) {
         while ($item = $news_item->fetch_array()) {
             $article['author'] = $user->create($item['pub_a']);
             $article['author'] = $user->getName();
             $article['editer'] = $user->create($item['edit_a']);
             $article['editer'] = $user->getName();
             $article['title'] = $item['title'];
             if ($this->publish) {
                 $article['pub'] = "<small>Published: " . date("H:i:s, D d/m/Y", strtotime($item['t_p'])) . "</small>";
                 $article['edit'] = "<small>Edited: " . date("H:i:s, D d/m/Y", strtotime($item['t_e'])) . "</small>";
                 if ($item['t_p'] != $item['t_e']) {
                     $this->editPub = true;
                 } else {
                     $this->editPub = false;
                 }
             } else {
                 $article['edit'] = $article['pub'] = "";
             }
             if ($item['long'] == "") {
                 $this->long = false;
             } else {
                 $this->long = true;
             }
             if ($this->preview) {
                 $article['content'] = $item['short'];
             } else {
                 if ($item['long'] != "") {
                     $article['content'] = "<b>" . $item['short'] . "</b><br />" . "\n" . $item['long'];
                 } else {
                     $article['content'] = $item['short'];
                 }
             }
         }
     } else {
         $article = false;
     }
     $this->article = $article;
     if ($article === false) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:48,代码来源:newsitem.php

示例6: run

 public function run()
 {
     $users = [['name' => 'Alexander Olly', 'address' => 'Melbourne, Australia', 'bday' => '03-18-1996', 'contact_no' => '09058593592', 'username' => 'alexander90', 'password' => Hash::make('awesome'), 'role' => 'admin'], ['name' => 'Justin Bieber', 'address' => 'Stratford, Ontario, Canada', 'bday' => '03-01-1994', 'contact_no' => '09058593592', 'username' => 'kidrauhl', 'password' => Hash::make('jelena'), 'role' => 'customer'], ['name' => 'Gabrielle Luna', 'address' => 'Maranding, Lala, Lanao del Norte', 'bday' => '03-18-1996', 'contact_no' => '09058593592', 'username' => 'gaboluna96', 'password' => Hash::make('keeperoflight'), 'role' => 'cashier']];
     foreach ($users as $user) {
         User::create($user);
     }
 }
开发者ID:emrys96,项目名称:sizzle-pizza,代码行数:7,代码来源:UserSeeder.php

示例7: _ops_update

function _ops_update()
{
    require_login();
    $msg = '';
    $uid = max(0, intval($_POST['uid']));
    $user = new User();
    if ($uid) {
        $user->retrieve($uid);
        $user->merge($_POST);
        if (!$user->exists()) {
            $msg = 'User not found!';
        } else {
            if ($user->update()) {
                $msg = 'User updated!';
            } else {
                $msg = 'User update failed!';
            }
        }
    } else {
        $user->merge($_POST);
        if ($user->create()) {
            $msg = 'User inserted!';
        } else {
            $msg = 'User insert failed!';
        }
    }
    redirect('users/manage', $msg);
}
开发者ID:469306621,项目名称:Languages,代码行数:28,代码来源:ops_update.php

示例8: run

 public function run()
 {
     DB::table('users')->delete();
     User::create(array('username' => 'talha', 'password' => Hash::make('talha'), 'email' => 'talhaqc@gmail.com', 'phone' => '01234', 'name' => 'MD. ABU TALHA', 'created_at' => new DateTime(), 'updated_at' => new DateTime()));
     DB::table('users')->insert(['username' => 'talha1', 'password' => Hash::make('talha1'), 'email' => 'talhaqc1@gmail.com', 'phone' => '012341', 'name' => 'MD. ABU TALHA1', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     DB::table('users')->insert(['username' => 'talha2', 'password' => Hash::make('talha2'), 'email' => 'talhaqc2@gmail.com', 'phone' => '012342', 'name' => 'MD. ABU TALHA2', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
 }
开发者ID:pnagaraju25,项目名称:larvelCrudFinal,代码行数:7,代码来源:UserTableSeeder.php

示例9: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('users', function ($table) {
         $table->create();
         $table->increments('id');
         $table->string('email');
         $table->string('firstname');
         $table->string('lastname');
         $table->string('street');
         $table->string('city');
         $table->string('state', 2);
         $table->integer('zipcode');
         $table->string('phone', 10)->nullable();
         $table->string('account', 32)->nullable()->unique();
         $table->string('token', 32)->nullable();
         $table->timestamps();
     });
     $seed = array(array(1, 'jabullard@aol.com', 'James', 'Bullard', '7027 Williamsburg Blvd', 'Arlington', 'VA', 22213, '9107996952', NULL, NULL, new DateTime(), new DateTime()), array(2, 'abullard@viimed.com', 'James', 'Bullard', '3911 Appleton Way', 'Wilmington', 'NC', 28412, '9107996952', NULL, NULL, new DateTime(), new DateTime()), array(3, 'aaron.bullard77@gmail.com', 'James', 'Bullard', '1441 Rhode Island Ave., NW Apt 209', 'Washington', 'DC', 20005, '9107996952', NULL, NULL, new DateTime(), new DateTime()));
     foreach ($seed as $rec) {
         $fields = array('id', 'email', 'firstname', 'lastname', 'street', 'city', 'state', 'zipcode', 'phone', 'account', 'token', 'create_at', 'updated_at');
         $insert = array();
         foreach ($fields as $key => $field) {
             $insert[$field] = $rec[$key];
         }
         $user = User::create($insert);
         $user->generate_account_hash(Config::get('litmus::private_key'))->save();
     }
 }
开发者ID:aaronbullard,项目名称:litmus,代码行数:33,代码来源:2013_08_05_230118_create_users_table.php

示例10: setupFoundorAndBaseRolsPermission

 public function setupFoundorAndBaseRolsPermission()
 {
     // Create Roles
     $founder = new Role();
     $founder->name = 'Founder';
     $founder->save();
     $admin = new Role();
     $admin->name = 'Admin';
     $admin->save();
     // Create User
     $user = User::create(['id' => 1, 'username' => 'zhanglei', 'password' => Hash::make('zhanglei'), 'email' => 'fcode520@gmail.com']);
     // Attach Roles to user
     $user->roles()->attach($founder->id);
     // Create Permissions
     $manageTopics = new Permission();
     $manageTopics->name = 'manage_topics';
     $manageTopics->display_name = 'Manage Topics';
     $manageTopics->save();
     $manageUsers = new Permission();
     $manageUsers->name = 'manage_users';
     $manageUsers->display_name = 'Manage Users';
     $manageUsers->save();
     // Assign Permission to Role
     $founder->perms()->sync([$manageTopics->id, $manageUsers->id]);
     $admin->perms()->sync([$manageTopics->id]);
 }
开发者ID:xiao-hu00,项目名称:phphub,代码行数:26,代码来源:2014_08_13_130603_entrust_setup_tables.php

示例11: run

 public function run()
 {
     Banner::truncate();
     Website::truncate();
     $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "heymandan@gmail.com", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now()));
     for ($x = 0; $x < 20; $x++) {
         $website = new Website();
         $website->url = "http://listviral.com";
         $website->enabled = true;
         $website->credits = 10000;
         $website->views = 0;
         $website->days = array();
         $website->hours = array();
         $user->websites()->save($website);
         $banner = new Banner();
         $banner->banner = "http://brisksurf.com/banner.png";
         $banner->url = "http://brisksurf.com";
         $banner->enabled = true;
         $banner->credits = 10000;
         $banner->views = 0;
         $banner->days = array();
         $banner->hours = array();
         $user->banners()->save($banner);
     }
 }
开发者ID:danielheyman,项目名称:TechDimeProjects,代码行数:25,代码来源:SurfSeeder.php

示例12: run

 public function run()
 {
     /**
      *  $userModel = User::find(1);
      *  $userModel->detachRoles($userModel->roles);
      */
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('roles')->truncate();
     DB::table('roles')->delete();
     DB::table('assigned_roles')->truncate();
     DB::table('assigned_roles')->delete();
     DB::table('users')->truncate();
     DB::table('users')->delete();
     User::create(array('firstname' => 'Администратор', 'email' => 'admin@treadtrack.net', 'password' => Hash::make('123456')));
     User::create(array('firstname' => 'Богдан', 'email' => 'ukrtvsat@ukr.net', 'password' => Hash::make('123456')));
     $role = new Role();
     $role->name = 'Customer';
     $role->save();
     $role = new Role();
     $role->name = 'Admin';
     $role->save();
     $admin = User::where('firstname', '=', 'Администратор')->first();
     $admin->attachRole($role);
     $user = User::where('firstname', '=', 'Богдан')->first();
     $user->attachRole($role);
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
开发者ID:Rotron,项目名称:shop,代码行数:27,代码来源:UserTableSeeder.php

示例13: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 2) as $index) {
         User::create(['role_id' => 1, 'username' => $faker->userName, 'password' => Hash::make('sandip'), 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'gender' => 'male']);
     }
 }
开发者ID:vik0803,项目名称:BugTrackerApp,代码行数:7,代码来源:UsersTableSeeder.php

示例14: User

 function step2($data)
 {
     //eseguo lo script MySQL
     if (!$this->mySqlInstall()) {
         $this->validationErrors['script_db'] = 'Errore nella compilazione del database';
         return false;
     }
     //inserisco i dati di configurazione dell'utente admin
     App::import('model', 'User');
     $User = new User();
     $User->create(array('User' => array('first_name' => $data['admin_first_name'], 'last_name' => $data['admin_last_name'], 'username' => $data['admin_username'], 'password' => Security::hash($data['admin_pwd'], null, true), 'email' => $data['admin_email'], 'role' => 0, 'active' => 1)));
     if (!$User->save()) {
         return false;
     }
     //scrivo il file installed.txt nella directory config
     App::import('core', 'File');
     $installedFile = new File(APP . 'config' . DS . 'installed.txt');
     $installedFile->create();
     //imposto correttamente i permessi sulle directories per la produzione
     if (!$this->setFolderPermissions($this->writableDirsForInstall, '0755')) {
         return false;
     }
     if (!$this->setFolderPermissions($this->writableDirsForProduction, '0755')) {
         return false;
     }
     //tutto ok
     return true;
 }
开发者ID:amerlini,项目名称:digigas-from-hg,代码行数:28,代码来源:installer.php

示例15: postregisterUser

 public function postregisterUser()
 {
     /*
      * Validation
      */
     $validation = Validator::make(Input::all(), array('username' => 'required|max:20|min:5|unique:users', 'fullname' => 'required|max:40', 'email' => 'required|max:50|email|unique:users', 'password' => 'required|min:6'));
     if ($validation->fails()) {
         return Redirect::route('registration')->withErrors($validation)->withInput();
     } else {
         //Create a user
         $username = Input::get('username');
         $fullname = Input::get('fullname');
         $email = Input::get('email');
         $password = Input::get('password');
         //Activation Code
         $code = str_random(60);
         $user = User::create(array('username' => $username, 'fullname' => $fullname, 'email' => $email, 'password' => Hash::make($password), 'code' => $code, 'active' => 0));
         if ($user) {
             //Send mail
             Mail::send('emails.auth.activate', array('link' => URL::route('activateAccount', $code), 'username' => $fullname), function ($message) use($user) {
                 $message->to($user->email, $user->fullname)->subject('Activate your account');
             });
             return View::make('users.registerConfirm')->with('title', 'Registration SuccessFul')->with('userFullName', $fullname)->with('userEmail', $email);
         }
     }
 }
开发者ID:AnwarAbir18,项目名称:mushkil-asan,代码行数:26,代码来源:UserManageController.php


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