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


PHP User::fill方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $user = new User();
     $user->fill(['name' => 'Erick Mo', 'email' => 'mo@thunderlab.id', 'password' => '123123123']);
     $user->save();
 }
开发者ID:ThunderID,项目名称:Halo,代码行数:12,代码来源:UserTableSeeder.php

示例2: createUser

 private static function createUser(Hybrid_User_Profile $profile)
 {
     $user = new User();
     $data = ['email' => $profile->email ? $profile->email : null, 'name' => $profile->displayName, 'avatar' => $profile->photoURL, 'country' => $profile->country, 'gender' => $profile->gender, 'region' => $profile->region, 'phone' => $profile->phone, 'city' => $profile->city, 'address' => $profile->address, 'birthday' => $profile->birthYear . '-' . $profile->birthMonth . '-' . $profile->birthDay, 'language' => $profile->language];
     $user->fill($data);
     $user->token = md5(sha1(\Config::get('app.key') . microtime() . rand()));
     $user->save();
     return $user;
 }
开发者ID:juanjolainez,项目名称:SecondLife,代码行数:9,代码来源:User.php

示例3: register

 public function register($data)
 {
     $roleUser = Role::getRoleByName('user');
     $user = new User();
     $user->fill($data);
     $user->setAttribute('status', true);
     $user->setAttribute('role_id', $roleUser->id);
     return $user->save();
 }
开发者ID:juliardi,项目名称:jualjasa,代码行数:9,代码来源:RegisterServiceImpl.php

示例4: store

 /**
  *
  */
 public function store(CreateUserRequest $request)
 {
     $user = new User();
     $user->fill($request->all());
     $user->company_id = Auth::user()->company_id;
     $user->password = bcrypt($request->input('password'));
     $user->save();
     Flash::success(trans('users/general.status.created'));
     return redirect('/users');
 }
开发者ID:ariefristyanto,项目名称:fleetmanagement,代码行数:13,代码来源:UsersController.php

示例5: store

 public function store(array $input)
 {
     $user = new User();
     $user->fill($input);
     $user = $this->setPassword($user, $input);
     $user->save();
     $this->linkToRole($user, $input);
     $this->linkToFaculty($user, $input);
     return $user;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:10,代码来源:UserService.php

示例6: doAdd

 public function doAdd(Request $request)
 {
     $user_form = $request->get('user');
     $user = new User();
     $user->fill($user_form);
     $user->password = Hash::make($user_form['password']);
     $user->faculty_id = $user_form["faculty_id"];
     $user->save();
     $user->roles()->sync($user_form["role_ids"]);
     return redirect('/backend/user');
 }
开发者ID:pchaow,项目名称:SuccessModel5,代码行数:11,代码来源:UserController.php

示例7: store

 public function store(Request $request)
 {
     $user = new User();
     $user->fill($request->all());
     $user->password = Hash::make($request->get('password'));
     if ($request->get('name') == "" || $request->get('email') == "" || $request->get('password') == "") {
         $request->session()->flash('error', 'Something was left blank');
         return redirect('/register');
     } else {
         Auth::login($user);
         return redirect('/#/editUser/' . $user->id);
     }
 }
开发者ID:Wade-Nairn,项目名称:nibblr-WE06,代码行数:13,代码来源:UserController.php

示例8: register

 public function register(Request $request)
 {
     $fields = array('email', 'password');
     foreach ($fields as $field) {
         if (!$request->input($field)) {
             return response()->json(array('error' => 'Missing field: ' . $field), 400);
         }
     }
     if (User::where('email', '=', $request->input('email'))->first()) {
         return response()->json(array('error' => 'An account already exists with this email address.'), 400);
     }
     $user = new User();
     $user->fill($request->all());
     $user->password = User::hashedPassword($request->input('password'));
     $user->save();
     return $this->login($request);
 }
开发者ID:wearedamage,项目名称:api-starter,代码行数:17,代码来源:AuthController.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $user = new User();
     $user->fill($request->all());
     $user->status_level = 0;
     $user->password = \Hash::make($request->password);
     $user->save();
     $scores = new Score();
     $scores->user_id = $user->id;
     $scores->value = 0;
     $scores->save();
     \Mail::send('emails.new_user', ['user' => $user], function ($message) use($user) {
         $message->to("airtonmfilho@hotmail.com", $user->name)->subject(trans('emails.new_user_title'));
     });
     \Auth::attempt(array('email' => $request->email, 'password' => $request->password));
     return redirect()->intended('/profile');
 }
开发者ID:jmoreirafilho,项目名称:SharingTests,代码行数:23,代码来源:HomeController.php

示例10: store

 /**
  * Store user
  *
  * @param array $data            
  * @throws NotFoundException, ValidationException
  * @return \App\Models\UserModel
  */
 public function store($data)
 {
     if (!array_get($data, 'password')) {
         unset($data['password']);
     }
     try {
         if (array_get($data, 'id')) {
             $user = UserModel::findOrFail((int) array_get($data, 'id'));
             // if this user's email is the same as what the data, then it's ok; otherwise, it has to be unique
             if (array_get($data, 'email') && $user->email == array_get($data, 'email')) {
                 $user->removeRule('email');
             }
             $user->fill($data);
         } else {
             $user = new UserModel();
             $user->fill($data);
         }
     } catch (Exception $e) {
         throw new NotFoundException(trans('app.notFound'));
     }
     if (!array_get($data, 'password')) {
         $user->removeRule('password');
     }
     if (!$user->validate()) {
         throw new ValidationException(trans('app.correctErrors'), $user->errors()->toArray());
     }
     if (array_get($data, 'password')) {
         $user->password = bcrypt($data['password']);
     }
     unset($user->password_confirmation);
     try {
         $user->save();
     } catch (Exception $e) {
         throw $e;
     }
     return $user;
 }
开发者ID:jasekz,项目名称:filament-for-laravel-5,代码行数:44,代码来源:User.php

示例11: loginFacebookUser

 /**
  * This method save or log in a user when is using FacebookAccount
  * @param $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 private function loginFacebookUser($request)
 {
     //load the facebook SDK object
     $fb = new Facebook(['app_id' => env('FB_API_ID'), 'app_secret' => env('FB_API_SECRET'), 'default_graph_version' => 'v2.2']);
     //set the token that whe receive from the request APP
     $fb->setDefaultAccessToken($request->input('token'));
     //Get the graph query
     try {
         $response = $fb->get('/me?fields=id,name,email');
         $fbUser = $response->getGraphUser();
     } catch (FacebookResponseException $e) {
         return response()->json($e->getMessage(), 401);
     } catch (FacebookSDKException $e) {
         return response()->json($e->getMessage(), 400);
     }
     //instantiate the new user
     $user = new User();
     //find by facebook_id and get the mongodb collection for users
     $users = $user->getCollection();
     $result = $users->findOne(['facebook_id' => $fbUser['id']]);
     if ($result) {
         var_dump('log in process by idfb');
         die;
     }
     //find by email
     $result = $users->findOne(['email' => $fbUser['email']]);
     if ($result) {
         var_dump('log in process by email');
         die;
     }
     //if not found then fill data and save account
     $user->fill($request);
     if (!$user->save()) {
         return response()->json('Error, the user was not created', 400);
     }
     return response()->json('success', 200);
 }
开发者ID:jarriaga,项目名称:endaroo,代码行数:42,代码来源:UserController.php

示例12: postUserUnban

 public function postUserUnban(User $user)
 {
     $user->fill(['banned' => false])->save();
     flash()->success(trans('messages.admin.unbanned_user', ['name' => $user->name]));
     return redirect()->back();
 }
开发者ID:TheReverend403,项目名称:uPste,代码行数:6,代码来源:AdminController.php

示例13: update

 /**
  * Update user
  *
  * @param User $user
  * @param array $data
  */
 public static function update(User $user, $data = array())
 {
     $user->fill($data);
     $user->update();
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:11,代码来源:ProfileService.php

示例14: update

 public function update(User $user, Request $request)
 {
     $user->fill($request->input())->save();
     return redirect()->route('users.index');
 }
开发者ID:berkapavel,项目名称:Laravel5-Time-Tracker-Project-manager,代码行数:5,代码来源:UsersController.php

示例15: store

 /**
  * store a resource 
  * @param  Request 	$this->request http request
  * @param  mixed  	$id      id of the resource for updating
  * @return jsend           	 jsend with newly stored source
  */
 function store($id = null)
 {
     ////////////////
     // Load Data  //
     ////////////////
     if ($id) {
         $data = Model::find($id);
         if (!$data) {
             return app()->abort(404);
         }
     } else {
         $data = new Model();
     }
     ///////////////////////////////////
     // Assign posted data to Data    //
     ///////////////////////////////////
     $data->fill($this->request->input());
     ///////////////////////
     // EMBED IMAGES 	 //
     ///////////////////////
     foreach ($this->request->input('images') as $x) {
         $images[] = new Image($x);
     }
     if (!$data->syncImages($images)) {
         return response()->json(JSend::fail($data->getErrors())->asArray())->setCallback($this->request->input('callback'));
     }
     ///////////////////////
     // EMBED AUTH    	 //
     ///////////////////////
     foreach ($this->request->input('auths') as $x) {
         $auths[] = new Auth($x);
     }
     if (!$data->syncAuths($auths)) {
         return response()->json(JSend::fail($data->getErrors())->asArray())->setCallback($this->request->input('callback'));
     }
     ///////////////////////
     // EMBED ACCOUNT  	 //
     ///////////////////////
     foreach ($this->request->input('account_connects') as $x) {
         $accounts[] = new AccountConnect($x);
     }
     if (!$data->syncAccountConnects($accounts)) {
         return response()->json(JSend::fail($data->getErrors())->asArray())->setCallback($this->request->input('callback'));
     }
     ///////////
     // Store //
     ///////////
     if ($data->save()) {
         /////////////////////
         // Return Response //
         /////////////////////
         return response()->json(JSend::success(['data' => $data->toArray()])->asArray());
     } else {
         return response()->json(JSend::fail($data->getErrors())->asArray());
     }
 }
开发者ID:erickmo,项目名称:CapcusAPI,代码行数:62,代码来源:UserAPI.php


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