本文整理汇总了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('/');
}
示例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);
}
示例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()));
}
示例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]);
}
示例5: getUpdate
public function getUpdate($id)
{
$user = $this->userRepository->getById($id);
$roles = $this->roleRepository->listForArr();
return view('weyi.user.update', compact('user', 'roles'));
}