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


PHP UserRepository::find方法代码示例

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


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

示例1: edit

 /**
  * Edit specific user
  *
  * @param  integer $id
  * @return View
  */
 public function edit($id)
 {
     // Get user and prepare the form
     $user = $this->user->find($id);
     $form = new UserForm($user, array('route' => array('system.users.update', $id)));
     return View::make('krustr::users.edit')->withUser($user)->withForm($form);
 }
开发者ID:creolab,项目名称:krustr,代码行数:13,代码来源:UsersController.php

示例2: viewAccountAction

 /**
  * GET /account(/:name).
  *
  * @param null|string $name
  */
 public function viewAccountAction($name = null)
 {
     $redis = $this->app->container->get('redis.client');
     $userRepository = new UserRepository($redis);
     $user = $userRepository->find($name);
     $jsonPath = $this->app->config('json_path') . 'users/github/' . $name . '.json';
     $this->app->notFoundIf(file_exists($jsonPath) === false)->redirectUnless($name, '/profile')->render('account.html', ['account' => $user]);
 }
开发者ID:Doanlmit,项目名称:pickleweb,代码行数:13,代码来源:UserController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $user = $this->userRepository->find($id);
     if (!$user) {
         return $this->toJSONResponse(['error' => ['status' => 400, 'message' => 'Invalid user id: ' . $id]], 400);
     }
     $user->remove();
     return $this->toJSONResponse([]);
 }
开发者ID:LeeKevin,项目名称:laravel-api,代码行数:15,代码来源:UsersController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @param Encrypter $encrypter
  * @param $hash
  * @return Response
  * @throws Exception
  */
 public function index(Encrypter $encrypter, $hash)
 {
     try {
         $params = $encrypter->decrypt($hash);
         $project = $this->projectRepository->find($params['project']);
         $user = $project->users->find($params['user']);
         if (is_null($user)) {
             throw new Exception('the user was not found');
         }
         $sourceClass = app()->make('Knoters\\Services\\Sources\\' . ucfirst($project->type->name) . 'Service');
         $video = $sourceClass->getVideo($project->video_id);
         $this->fractal->setSerializer(new ArraySerializer());
         JavaScriptFacade::put(['user' => $this->fractal->createData(new Item($user, new UserTransformer()))->toArray(), 'project' => $this->fractal->createData(new Item($project, new ProjectTransformer()))->toArray()]);
         return view('editor', ['video' => $video, 'project' => $project]);
     } catch (Exception $e) {
         throw $e;
         $this->errorResponse($e);
     }
 }
开发者ID:kife-design,项目名称:knoters,代码行数:27,代码来源:EditorController.php

示例5: display

 /**
  * Methode zum anzeigen des Contents.
  *
  * @return String Content der Applikation.
  */
 public function display()
 {
     $user = UserRepository::find($this->request['id']);
     if ($user !== null) {
         $res = $user->toArray();
         $res['status'] = 'success';
     } else {
         $res = array('status' => 'error');
     }
     $this->view->setTemplate($this->template);
     $this->view->assign('outlet', json_encode($res));
     return $this->view->loadTemplate();
 }
开发者ID:OSPFIA32,项目名称:osp,代码行数:18,代码来源:User.php

示例6: show

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

示例7: compose

 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $view->with('contact', $this->users->find($view->getData()['user']['id']));
 }
开发者ID:Bottelet,项目名称:Flarepoint-crm,代码行数:10,代码来源:UserHeaderComposer.php

示例8: factory

 /** @test **/
 function it_finds_the_model_with_the_given_id_and_the_selected_fields()
 {
     $user = factory(User::class)->times(10)->create()->last();
     // Fetch the last created user.
     $repository = new UserRepository($this->newContainerMock(new User()));
     $actual = $repository->find($user->id, ['email']);
     $this->assertEquals(['email'], array_keys($actual->toArray()));
 }
开发者ID:thirteen,项目名称:repositories,代码行数:9,代码来源:AbstractRepositoryTest.php

示例9: user

 /**
  * The `User` instance for the currently-logged-in user, if present
  *
  * @protected
  * @return null|\User
  */
 protected function user()
 {
     if (!$this->authenticated()) {
         return null;
     }
     return $this->userRepository->find($this->session->get('user_id'));
 }
开发者ID:deefour,项目名称:aide,代码行数:13,代码来源:Controller.php


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