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


PHP User::Create方法代码示例

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


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

示例1: createUser

 function createUser(Request $request)
 {
     $person = User::Create($request->all());
     $person->password = bcrypt($request['password']);
     $person->save();
     return $person;
 }
开发者ID:Kishimotovn,项目名称:IMS_Laravel,代码行数:7,代码来源:UserController.php

示例2: register

 /**
  * Register a new user or we can say sign up
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 public function register(RegisterRequest $request)
 {
     $rqst = new rqst();
     $data = $request->all();
     $data['password'] = bcrypt($data['password']);
     $users = User::Create($data);
     if (\Auth::attempt(['username' => $data['username'], 'password' => $request->get('password')])) {
         User::where('id', '=', \Auth::user()->id)->update(array('logged_in' => '1'));
         \Flash::message('You are successfully registered.');
         return \Redirect::action('HomeController@dashboard');
         //,compact('users'));
     }
 }
开发者ID:kranti52,项目名称:LaravelRatchetChatRoom,代码行数:19,代码来源:AuthController.php

示例3: findByUsernameOrCreate

 public function findByUsernameOrCreate($userData)
 {
     $user = User::where('email', $userData->email)->first();
     if (count($user) > 0) {
         return $user;
     }
     $user = User::Create(['firstname' => !empty($userData->user['first_name']) ? $userData->user['first_name'] : $userData->nickname, 'lastname' => !empty($userData->user['last_name']) ? $userData->user['last_name'] : '', 'email' => !empty($userData->email) ? $userData->email : '', 'status' => 1]);
     if (!empty($user) && !empty($userData->avatar)) {
         $name = time() . '.jpg';
         $path = public_path() . '/files/avatar/';
         File::makeDirectory($path, $mode = 0777, true);
         Image::make($userData->avatar)->save($path . $name);
         $user->avatar = $name;
         $user->save();
     }
     return $user;
 }
开发者ID:gaurangsudra,项目名称:laravel51-multiauth-socialite,代码行数:17,代码来源:UserRepository.php

示例4: findSocialiteIdOrCreate

 public function findSocialiteIdOrCreate($userData)
 {
     if ($userData->socialiteName == 'weibo') {
         $user = User::where('weibo_id', '=', $userData->weibo_id)->first();
         if (!$user) {
             $user = User::Create(['nickname' => $userData->input('nickname'), 'avatar' => $userData->input('avatar'), 'weibo_id' => $userData->input('weibo_id'), 'signature' => $userData->input('signature'), 'email' => $userData->input('email'), 'sex' => $userData->input('sex')]);
             $location = $user->location();
             $location->firstOrCreate(['country' => $userData->input('country'), 'province' => $userData->input('province'), 'city' => $userData->input('city')]);
         }
     } elseif ($userData->socialiteName == 'weixin') {
         $user = User::where('weixin_id', '=', $userData->weixin_id)->first();
         if (!$user) {
             $user = User::Create(['nickname' => $userData->input('nickname'), 'avatar' => $userData->input('avatar'), 'weixin_id' => $userData->input('weixin_id'), 'signature' => $userData->input('signature'), 'email' => $userData->input('email'), 'sex' => $userData->input('sex')]);
             $location = $user->location();
             $location->firstOrCreate(['country' => $userData->input('country'), 'province' => $userData->input('province'), 'city' => $userData->input('city')]);
         }
     }
     return User::with('location')->find($user->id);
 }
开发者ID:nutsdo,项目名称:mz-service,代码行数:19,代码来源:UserRepository.php

示例5: findByUsernameOrCreate

 public function findByUsernameOrCreate($userData)
 {
     $users = User::where('user_email', '=', $userData->email)->first();
     if (!$users) {
         //email not used
         if ($userData->nickname == null) {
             $user = User::Create(['user_firstname' => $userData->name, 'user_email' => $userData->email, 'avatar' => $userData->avatar, 'role_id' => 3, 'provider_id' => $userData->id]);
         } else {
             $user = User::Create(['user_firstname' => $userData->nickname, 'user_email' => $userData->email, 'avatar' => $userData->avatar, 'role_id' => 3, 'provider_id' => $userData->id]);
         }
         return $user;
     } else {
         $users = User::where('user_email', '=', $userData->email)->where('provider_id', '=', $userData->id)->first();
         if ($users) {
             //email used with same provider id
             return $users;
         } else {
             //email is used with different provider id
             //cannot sign up with same email because different provider id(email cannot be duplicate user)
             $user = false;
             return $user;
         }
     }
 }
开发者ID:aminaminamin93,项目名称:pricescales,代码行数:24,代码来源:UserRepository.php

示例6: postRegister

 public function postRegister(Request $request)
 {
     $user = ["remember_token" => Request::get('_token'), "name" => Request::get('name'), "password" => hash::make(Request::get('password')), "email" => Request::get('email'), "role_id" => 1];
     User::Create($user);
 }
开发者ID:nhunght,项目名称:mork_SmartOSC,代码行数:5,代码来源:AdminController.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     User::Create(['email' => 'jyrone.parker@gmail.com', 'password' => bcrypt('n1nt3nd0'), 'name' => 'Jyrone Parker', 'api_token' => str_random(60)]);
 }
开发者ID:mastashake08,项目名称:ava,代码行数:10,代码来源:UserTableSeeder.php

示例8: create

 public function create(array $data)
 {
     return User::Create(['name' => $data['name'], 'password' => Hash::make($data['password']), 'email' => $data['email'], 'signature' => $data['signature'], 'telephone' => $data['telephone'], 'sex' => $data['sex'], 'is_banned' => $data['is_banned']]);
 }
开发者ID:nutsdo,项目名称:rp-wechat,代码行数:4,代码来源:UserRepository.php

示例9: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::Create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'phone' => $data['phone']]);
 }
开发者ID:joshvisk,项目名称:p4,代码行数:10,代码来源:AuthController.php

示例10: userCreateOrUpdate

 /**
  * Create a new user or update an existing one.
  *
  * @param  array  $credentials
  * @param  sting  $id
  * @return $this
  */
 protected function userCreateOrUpdate($credentials, $id)
 {
     $user = ['first_name' => $credentials['first_name'], 'last_name' => $credentials['last_name'], 'username' => $credentials['username'], 'password' => bcrypt($credentials['password']), 'email' => $credentials['email'], 'title' => $credentials['title'], 'group' => $credentials['group'], 'ers_id' => $credentials['ers_id']];
     if (!$id) {
         User::Create($user);
     }
     if ($id) {
         User::find($id)->update($user);
     }
 }
开发者ID:EuropeanRespiratorySociety,项目名称:ERSTemplate-dev,代码行数:17,代码来源:ErsUserProvider.php


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