本文整理汇总了PHP中App\Repositories\UserRepository::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::update方法的具体用法?PHP UserRepository::update怎么用?PHP UserRepository::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Repositories\UserRepository
的用法示例。
在下文中一共展示了UserRepository::update方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @param UserEditPasswordRequest $request
* @return Response
*/
public function update($id, UserEditPasswordRequest $request)
{
$input = $request->only('password', 'password_confirmation');
$user = $this->userRepository->update($id, $input);
Flash::message('Contraseña actualizada');
return Redirect()->route('profile.edit', $user->username);
}
示例2: update
/**
* Update the specified user in storage.
*
* @param int $id
* @param UserEditRequest $request
* @return Response
*/
public function update($id, UserEditRequest $request)
{
$input = $request->only('username', 'email', 'password', 'password_confirmation');
$this->userRepository->update($id, $input);
Flash::message('User updated');
return Redirect()->route('users');
}
示例3: 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]);
}
示例4: update
/**
* Update the specified User in storage.
* PUT/PATCH /users/{id}
*
* @param int $id
* @param Request $request
*
* @return Response
*/
public function update($id, Request $request)
{
$input = $request->all();
/** @var User $user */
$user = $this->userRepository->apiFindOrFail($id);
$result = $this->userRepository->update($input, $id);
$user = $user->fresh();
return $this->sendResponse($user->toArray(), "User updated successfully");
}
示例5: updateUser
public function updateUser(array $data, $id)
{
try {
$user = $this->userRepository->update($data, $id);
} catch (RepositoryException $e) {
Log::warning('An additional info of the user (id:' . $id . ' ) information was\'nt updated. ' . $e->getMessage());
throw new AuthException($e->getMessage(), null, $e);
}
return $user;
}
示例6: update
/**
* Update the specified User in storage.
*
* @param int $id
* @param UpdateUserRequest $request
*
* @return Response
*/
public function update($id, UpdateUserRequest $request)
{
$user = $this->userRepository->find($id);
if (empty($user)) {
Flash::error('User not found');
return redirect(route('users.index'));
}
$user = $this->userRepository->update($request->all(), $id);
Flash::success('User updated successfully.');
return redirect(route('users.index'));
}
示例7: update
/**
* Update the specified User in storage.
*
* @param int $id
* @param UpdateUserRequest $request
*
* @return Response
*/
public function update($id, UpdateUserRequest $request)
{
$this->authorize('users.manage');
$user = $this->userRepository->findWithoutFail($id);
if (empty($user)) {
Flash::error('User not found');
return redirect(route('users.index'));
}
$input = $request->all();
if (!empty($input['password'])) {
$input['password'] = bcrypt($input['password']);
} else {
unset($input['password']);
}
$user = $this->userRepository->update($input, $id);
$user->roles()->sync([$request->get('role')]);
Flash::success('User updated successfully.');
return redirect(route('users.index'));
}
示例8: updateSeen
/**
* Update the specified resource in storage.
*
* @param Illuminate\Http\Request $request
* @param App\Models\User $user
* @return Response
*/
public function updateSeen(Request $request, $user)
{
$this->user_gestion->update($request->all(), $user);
return response()->json();
}
示例9: postProfile
/**
* Handle a change profile request for the application.
*
* @param \Illuminate\Http\Request $request
* @param App\Repositories\UserRepository
* @return \Illuminate\Http\Response
*/
public function postProfile(Request $request, UserRepository $userRepository)
{
$this->validate($request, ['name' => 'required|max:255']);
//print_r($request); die;
$user = $userRepository->update($request);
return redirect('/auth/profile');
}
示例10: update
/**
* Update the specified resource in storage.
*
* @param UserRequest $request
* @param int $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UserRequest $request, $id)
{
$this->users->update($request->all(), $id);
return redirect()->route('admin.users.index');
}
示例11: update
/**
* Update the user.
*
* @param UserRepository $userRepository
* @param SettingsUpdateRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UserRepository $userRepository, SettingsUpdateRequest $request)
{
$userRepository->update(Auth::user(), $request->all());
return redirect()->back()->with(['notice' => Lang::get('user.user_updated')]);
}
示例12: postUpdate
public function postUpdate(UpdateRequest $request, $id)
{
$this->userRepository->update($id, $request->all());
return responseSuccess('修改成功', 'user/index');
}