本文整理汇总了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);
}
示例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]);
}
示例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([]);
}
示例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);
}
}
示例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();
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$user = $this->user->find($id);
return $user;
}
示例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']));
}
示例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()));
}
示例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'));
}