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


PHP UserRepository::getById方法代码示例

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


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

示例1: getResend

 public function getResend(UserRepository $user_gestion, Request $request)
 {
     if ($request->session()->has('user_id')) {
         $user = $user_gestion->getById($request->session()->get('user_id'));
         $this->dispatch(new SendMail($user));
         return redirect('/')->with('ok', trans('front/verify.resend'));
     }
     return redirect('/');
 }
开发者ID:nguyenngochainam92,项目名称:sellShop,代码行数:9,代码来源:AuthController.php

示例2: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $routeName = 'user';
     $routeMethod = 'edit';
     $user = $this->user->getById($id);
     $roles = $this->role->getAllOrderedBy('name');
     $data = compact('routeName', 'routeMethod', 'user', 'roles');
     \Clockwork::info($user);
     return view('admin.sections.user.edit', $data);
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:16,代码来源:UsersController.php

示例3: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize(HttpRequest $request, UserRepository $users)
 {
     // Get the id of the user from the route
     $userId = $request->persons;
     $user = $users->getById($userId);
     // User not found
     if (empty($user)) {
         abort(404);
     }
     // The person to view the profile of
     $this->person = new Person();
     $this->person->setNode($user);
     // The profile can be viewed when
     // * The profile is set to be accessible
     // * The logged in user is viewing his own profile
     // * The user of the profile has set a certain role to allow to view the profile
     // and the logged in user has a role that belongs to that set
     return $this->person->profileAccessLevel == 4 || !empty($request->user()) && ($request->user()->id == $this->person->id || $request->user()->hasRole($this->person->getProfileAllowedRoles()));
 }
开发者ID:weopendata,项目名称:medea,代码行数:24,代码来源:ViewUserRequest.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param ShowFindRequest $request
  *
  * @return \Illuminate\Http\Response
  */
 public function show(ShowFindRequest $request)
 {
     $find = $request->getFind();
     // If the user is not owner of the find and not a researcher, obscure the location to 1km accuracy
     if (empty($user) || !empty($find['person']['identifier']) && $find['person']['identifier'] != $user->id && !in_array('onderzoeker', $user->getRoles())) {
         if (!empty($find['findSpot']['location']['lat'])) {
             $find['findSpot']['location']['lat'] = round($find['findSpot']['location']['lat'] / 2, 2) * 2;
             $find['findSpot']['location']['lng'] = round($find['findSpot']['location']['lng'] / 2, 2) * 2;
         }
     }
     $users = new UserRepository();
     // Check if the user of the find allows their name to be displayed on the find details
     $findUser = $users->getById($find['person']['identifier']);
     $publicUserInfo = [];
     if (!empty($findUser)) {
         $person = new Person();
         $person->setNode($findUser);
         if ($person->showNameOnPublicFinds) {
             $publicUserInfo['name'] = $person->lastName . ' ' . $person->firstName;
         }
         // Should there be a link to the profile page
         if ($person->profileAccessLevel == 4 || !empty($request->user()) && ($request->user()->id == $person->id || $request->user()->hasRole($person->getProfileAllowedRoles()))) {
             $publicUserInfo['id'] = $person->id;
         }
     }
     return view('pages.finds-detail', ['fields' => $this->list_values->getFindTemplate(), 'find' => $find, 'publicUserInfo' => $publicUserInfo]);
 }
开发者ID:weopendata,项目名称:medea,代码行数:34,代码来源:FindController.php

示例5: getUpdate

 public function getUpdate($id)
 {
     $user = $this->userRepository->getById($id);
     $roles = $this->roleRepository->listForArr();
     return view('weyi.user.update', compact('user', 'roles'));
 }
开发者ID:lanzhiwang,项目名称:laravel-blog,代码行数:6,代码来源:UserController.php


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