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


PHP UserRepository::find方法代码示例

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


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

示例1: ban

 /**
  * Ban user
  *
  * @param Request $request
  * @param $user
  * @return Redirect
  */
 public function ban(Request $request, $user)
 {
     $userToBan = $this->users->find($user);
     $userToBan->banned = 1;
     $userToBan->save();
     return redirect('/posts');
 }
开发者ID:aliaseight,项目名称:laravel-red9k,代码行数:14,代码来源:UserController.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $this->userRepository->find($this->authorizer->getResourceOwnerId());
     App::singleton('user', function () use($user) {
         return $user->toArray();
     });
     return $next($request);
 }
开发者ID:team-ccsad,项目名称:project-101,代码行数:15,代码来源:Authenticate.php

示例3: loginByCookie

 public function loginByCookie($cookie)
 {
     $user = $this->createOrUpdateUserByCookie($cookie);
     // Login
     $this->guard->login($user, true);
     // Return an actual user model if login passes
     if ($this->guard->check()) {
         return $this->userRepository->find($this->guard->id());
     } else {
         $errorMessage = 'Login error. User is not authorized. (binary_id: ' . $user->binary_id . ')';
         Log::error($errorMessage);
         throw new AuthException($errorMessage);
     }
 }
开发者ID:BinaryStudioAcademy,项目名称:reviewr,代码行数:14,代码来源:AuthService.php

示例4: update

 /**
  * @param $id
  * @param UpdateUserRequest $request
  */
 public function update(UpdateUserRequest $request, $id)
 {
     $user = $this->user->find($id);
     $user->email = $request->get('email');
     if ($request->get('password')) {
         $user->password = $request->get('password');
     }
     $user->save();
     if ($request->get('role')) {
         $user->roles()->sync($request->get('role'));
     } else {
         $user->roles()->sync([]);
     }
     Flash::success('User successfully updated');
     return redirect('/users');
 }
开发者ID:ampodobas,项目名称:laravel-entrust-role-permission-panel,代码行数:20,代码来源:UsersController.php

示例5: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserRepository $userRepository)
 {
     $user = $userRepository->find($this->user['id']);
     if (!Hash::check($this->params['old_password'], $user->password)) {
         throw new PasswordNotMatch();
     }
     $password = bcrypt($this->params['password']);
     return $userRepository->update($this->user['id'], ['password' => $password]);
 }
开发者ID:team-ccsad,项目名称:project-101,代码行数:14,代码来源:ChangePassword.php

示例6: destroy

 /**
  * Remove the specified User from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $user = $this->userRepository->find($id);
     if (empty($user)) {
         Flash::error('User not found');
         return redirect(route('users.index'));
     }
     $this->userRepository->delete($id);
     Flash::success('User deleted successfully.');
     return redirect(route('users.index'));
 }
开发者ID:jonphipps,项目名称:api-registry,代码行数:18,代码来源:UserController.php

示例7: disableSelected

 /**
  * @return \Illuminate\View\View
  */
 public function disableSelected(Request $request)
 {
     $chkUsers = $request->input('chkUser');
     if (isset($chkUsers)) {
         foreach ($chkUsers as $user_id) {
             $user = $this->user->find($user_id);
             if (!$user->canBeDisabled()) {
                 Flash::error(trans('admin/users/general.error.cant-be-disabled'));
             } else {
                 $user->enabled = false;
                 $user->save();
             }
         }
         Flash::success(trans('admin/users/general.status.global-disabled'));
     } else {
         Flash::warning(trans('admin/users/general.status.no-user-selected'));
     }
     return redirect('/admin/users');
 }
开发者ID:slakbal,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:22,代码来源:UsersController.php

示例8: create

 public function create($id, UserRepository $userRepository, Auth $auth)
 {
     $data = ['user' => $userRepository->find($id), 'authUser' => $auth->user()];
     return View('transactions.new')->with($data);
 }
开发者ID:natanaelphp,项目名称:Dividas2.0,代码行数:5,代码来源:TransactionController.php

示例9: getInfo

 /**
  * @param Request $request
  * @return mixed
  */
 public function getInfo(Request $request)
 {
     $id = $request->input('id');
     $user = $this->user->find($id);
     return $user;
 }
开发者ID:koanreview,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:10,代码来源:UsersController.php

示例10: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  *
  * @return \Illuminate\View\View
  */
 public function edit($id)
 {
     $user = $this->users->find($id);
     return view('backend.users.edit', compact('user'));
 }
开发者ID:pet1330,项目名称:tyloo,代码行数:12,代码来源:UsersController.php

示例11: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function show($id)
 {
     $user = $this->repo->find($id);
     return view('');
 }
开发者ID:valdinei,项目名称:rest,代码行数:12,代码来源:UserController.php

示例12: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserRepository $userRepository)
 {
     $user = $userRepository->find($this->user['id']);
     return $user;
 }
开发者ID:team-ccsad,项目名称:project-101,代码行数:10,代码来源:GetAdminInfo.php


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