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


PHP User::load方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->config = new Config();
     $this->db = new \App\Db();
     // User.
     $this->user = new User($this->db);
     if (isset($_SESSION['userid'])) {
         $this->user->load($_SESSION['userid']);
     }
 }
开发者ID:samwilson,项目名称:swidau,代码行数:10,代码来源:Base.php

示例2: updateRoles

 /**
  * Assign permissions to user
  */
 public function updateRoles(Request $request, User $user)
 {
     $roles = $request->checkedRoles ?: [];
     // $roles = array of submitted roles OR if all checkboxes were unchecked, make it an empty array
     $user->roles()->sync($roles);
     logThis('Roles for ' . $user->name . ' changed to ' . $user->roles()->lists('label'));
     return $user->load('roles');
 }
开发者ID:goatatwork,项目名称:access2,代码行数:11,代码来源:UsersApiController.php

示例3: makeClientToken

 public function makeClientToken(User $user)
 {
     $user->load('oauth_client');
     if (!$user->oauth_client) {
         $client_id = $this->createOauthClient(false, false, $user->email, false, $user->id);
     } else {
         $client_id = $user->oauth_client->id;
     }
     $session_id = $this->createSession(false, $client_id, $user, 'client');
     $token_id = $this->createAccessToken(false, $session_id);
     return $token_id;
 }
开发者ID:alnutile,项目名称:oauth_how_to,代码行数:12,代码来源:OauthService.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $user = new User();
     $user->first_name = $request->input('first_name');
     $user->middle_name = $request->has('middle_name') ? $request->input('middle_name') : '';
     $user->last_name = $request->input('last_name');
     $user->phone = $request->has('phone') ? $request->input('phone') : '';
     $user->email = $request->input('email');
     $user->user_name = $request->input('user_name');
     $user->role = $request->input('role');
     $user->password = Hash::make($request->input('password'));
     $user->recipient_id = $request->input('recipient_id');
     $user->save();
     Log::create(array("user_id" => Auth::user()->id, "action" => "Add user named " . $user->first_name, " " . $user->last_name));
     return $user->load('recipient', 'roles');
 }
开发者ID:kelvinmbwilo,项目名称:VVS,代码行数:22,代码来源:UserController.php

示例5: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  User  $user
  * @param \App\Classes\Rank $rank,
  * @param \App\Classes\Country $country,
  * @return \Illuminate\Http\Response
  */
 public function edit(User $user, Rank $rank, Country $country)
 {
     $user->load('categories');
     return view('admin.user.edit', ['user' => $user, 'ranks' => $rank->getRanks(), 'countries' => $country->getCountries(), 'reviewer' => 1, 'selectedCategories' => $user->categories->lists('id')->toArray(), 'categories' => getNomenclatureSelect($this->getCategories($user->department_id))]);
 }
开发者ID:Tisho84,项目名称:conference,代码行数:13,代码来源:UsersController.php

示例6: pushUser

 /**
  *  Create a new user from request.
  *
  * @param $request input form data
  * @return User
  */
 public function pushUser($request)
 {
     $input = $request->all();
     $secret = $input['password'];
     $input['password'] = Hash::make($input['password']);
     $user = new User();
     $user->fill($input);
     $user->save();
     $user->role()->attach(1);
     $user->load('role');
     //$this->sendWelcome($user, $secret);
     return $user;
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:19,代码来源:User.php

示例7: show

 /**
  * Display the specified resource.
  *
  *
  * @param User $user
  *
  * @return Response
  */
 public function show(User $user)
 {
     $user->load('orders', 'orders.products');
     $orders = $user->orders()->get();
     return view('users.show', compact('user', 'orders'));
 }
开发者ID:Tisho84,项目名称:laravel-work,代码行数:14,代码来源:UsersController.php

示例8: show

 public function show(User $user)
 {
     $user->load('biography', 'contactDetails', 'address', 'profile', 'artwork');
     return view('frontend.pages.user.show', compact('user'));
 }
开发者ID:LichtAnd,项目名称:nkg,代码行数:5,代码来源:UserController.php

示例9: remindReset

 public function remindReset(Request $request, Response $response, array $args)
 {
     $template = new \App\Template('remind_reset.twig');
     // First check that the passwords match.
     $password = $request->get('password');
     if ($password !== $request->get('password-confirmation')) {
         $template->alert('warning', 'Your passwords did not match.', true);
         return new RedirectResponse($this->config->baseUrl() . "/remind/" . $args['userid'] . "/" . $args['token']);
     }
     // Then see if the token is valid.
     $user = new User($this->db);
     $user->load($args['userid']);
     if (!$user->checkReminderToken($args['token'])) {
         $template->alert('warning', 'That reminder token has expired. Please try again.', true);
         return new RedirectResponse($this->config->baseUrl() . "/remind");
     }
     // Finally change the password. This will delete the token as well.
     $user->changePassword($password);
     $template->alert('success', 'Your password has been changed. Please log in.', true);
     return new RedirectResponse($this->config->baseUrl() . "/login?name=" . $user->getName());
 }
开发者ID:samwilson,项目名称:swidau,代码行数:21,代码来源:UserController.php

示例10: setGroup

 /**
  * @param \App\User $user
  * @param \App\Group $group
  * @return $this
  */
 public function setGroup(\App\User $user, \App\Group $group)
 {
     $user->group()->associate($group);
     $user->load('group');
     return $this;
 }
开发者ID:ndrx-io,项目名称:elude,代码行数:11,代码来源:User.php


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