當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。