Attempts to update the user profile.

@param UpdateUserRequest $request
@return RedirectResponse
329949
public function update(UpdateUserRequest $request)
    {
        $this->dispatch(new UpdateUser($this->auth->user()->id, $request->get('name'), $request->get('email')));
        return redirect()->route('authentication::profile.show');
    }
1153069
public function store(AdminUserRequest $request)
    {
        $request->merge(['password' => bcrypt($request->get('password'))]);

        $this->repository->create($request->all());

        return redirect()->route('admin.admin-user.index');
    }
1306974
public function update(Request $request) {
        $response = $this->dispatchFrom(UpdateUserCommand::class, $request);

        Session::flash('status_code', $response['status_code'] );

        if ($response['status_text'] == "validation_failed")
        {
            Session::flash('message', $response['errorMessages']->first());

            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data'])
                ->withErrors($response['errorMessages']);
        }


        if ($response['status_text'] == "persist_failed")
        {
            $message = "Persist failed. It does not happen often, but Laravel's save failed. The database operation is called at Lasallecms\Lasallecmsapi\Users\UpdateUserFormProcessing. MySQL probably hiccupped, so probably just try again.";
            Session::flash('message', $message);

            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data']);
        }


        $name = strtoupper($response['data']['name']);
        $message = 'Your "'.$name.'" user updated successfully!';
        Session::flash('message', $message);
        return Redirect::route('admin.users.index');
    }
1223606
public function update(UpdateUserPost $request, $id)
    {
        $model = (new Services\UsersService)->dataUpdate($id, $request->all());
        return back()->with('success', "Os dados de '{$model->name}' foram atualizados com sucesso");
    }
551386
public function update(AccountSettingsRequest $request)
    {
        $data = $request->validated();
        $currentUser = $request->user($this->getGuard());

        ! $request->hasFile('profile_picture')
        || $currentUser->addMediaFromRequest('profile_picture')
                       ->sanitizingFileName(function ($fileName) {
                           return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
                       })
                       ->toMediaCollection('profile_picture', config('cortex.auth.media.disk'));

        ! $request->hasFile('cover_photo')
        || $currentUser->addMediaFromRequest('cover_photo')
                       ->sanitizingFileName(function ($fileName) {
                           return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
                       })
                       ->toMediaCollection('cover_photo', config('cortex.auth.media.disk'));

        // Update profile
        $currentUser->fill($data)->save();

        return intend([
            'back' => true,
            'with' => ['success' => trans('cortex/auth::messages.account.updated_account')]
                      + (isset($data['two_factor']) ? ['warning' => trans('cortex/auth::messages.verification.twofactor.phone.auto_disabled')] : []),
        ]);
    }
1277562
public function update(LoggedUserPasswordUpdate $request)
    {
        $user = Auth::user();
        if (! $this->checkCurrentPassword($request, $user)) {
            return new JsonResponse(
                [
                  'message'=> 'The given data was invalid.',
                  'errors'=> [
                    'current_password' => [ 'The password is not valid']
                  ]
                ],
                422
            );
        }
        $user->update(['password' => bcrypt($request->password)]);

        return $user;
    }
727185
public function updateUser(UpdateProfileUserRequest $request)
    {
        $input = [];

        if ($this->auth->user()->can('user::change-own-name')) {
            $input = array_merge($input, [
                'first_name' => $request->first_name,
                'last_name'  => $request->last_name,
            ]);
        }

        if ($this->auth->user()->can('user::change-own-email')) {
            $input = array_merge($input, [
                'email' => $request->email,
            ]);
        }

        $this->user->update($input, $this->auth->id());

        flash(trans('core::messages.resource.resource updated', ['name' => trans('user::profile.title.profile')]));

        return redirect()->back();
    }
772997
private function mainUpdateProfile($request)
    {
        $this->validate($request, [
            'name'              => 'required|min:3|max:191',
            'current_password'  => 'required',
        ]);

        $user = User::findOrFail(Auth::id()); // To use Laralum user model

        if (!Hash::check($request->current_password, $user->password)) {
            // Password incorrect
            return __('laralum_profile::general.incorrect_password'); // Update error: incorrect password
        }
        if ($request->hasFile('picture')) {
            $this->validate($request, [
                'picture' => 'image|max:5120',
            ]);

            if ($request->file('picture')->isValid()) {
                $request->file('picture')->move(public_path('/avatars'), md5($user->email));
            } else {
                return __('laralum_profile::general.image_not_valid'); // Update error: image not valid
            }
        } else {
            if ($user->hasAvatar()) {
                if (!$request->save_picture) {
                    File::delete(public_path('/avatars/'.md5($user->email)));
                }
            }
        }
        if ($request->password) {
            $this->validate($request, [
                'password' => 'min:6|confirmed',
            ]);
            $user->update(['password' => $request->password]);
        }

        if ($request->name) {
            $user->update(['name' => $request->name]);
        }

        return 0; // Updated completed okai
    }
360736
public function update(Request $request)
    {
        $this->validate($request, [
            'navbar_color' => 'max:255',
            'favicon'      => 'url|max:2000',
        ]);
        Customization::first()->update([
            // 'color'             => $request->input('color'),
            // 'background_color'  => $request->input('background_color'),
            'navbar_color'      => $request->navbar_color,
            'favicon'           => $request->favicon,
        ]);

        return redirect()->route('laralum::settings.index', ['p' => 'Customization'])->with('success', __('laralum_customization::general.updated_settings'));
    }
1256593
public function update(LoggedUserUpdate $request)
    {
        $user = Auth::user();
        $user->update($request->only(['name','email','password']));

        return $user;
    }
589415
public function store(CreateUserRequest $request)
    {
        $this->user->createWithRoles($request->all(), $request->roles);

        flash(trans('core::messages.resource.resource created', ['name' => trans('user::users.title.user')]));

        return redirect()->route('backend::user.user.index');
    }
1232222
public function update(Request $request)
    {
        $user = $request->user();

        $this->validate($request, [
            'name' => 'required',
            'email' => 'required|email|unique:users,email,'.$user->id,
        ]);

        return tap($user)->update($request->only('name', 'email'));
    }
1170499
public function update(ResetPasswordRequest $request)
    {
        try {
            $this->dispatch(new ResetPassword($request->get('token'), $request->get('email'), $request->get('password')));

            return redirect()->route('authentication::session.create')->withErrors([
                'authentication::password-reset.updated' => trans('authentication::password-reset.updated'),
            ]);
        } catch (TokenIsExpired $e) {
            return redirect()->route('authentication::password-reset.create')->withErrors([
                'authentication::password-reset.expired' => trans('authentication::password-reset.expired'),
            ]);
        }
    }
75080
public function update(UpdateRequest $request)
    {
        $this->addDefaultGeoFields(\Request::input('template'));
        $this->useTemplate(\Request::input('template'));

        return parent::updateCrud();
    }
992515
public function update($id,Request $request)
    {
        $user_setting = User_setting::findOrfail($id);
    	
        $user_setting->user_id = $request->user_id;
        
        $user_setting->setting_id = $request->setting_id;
        
        $user_setting->notes = $request->notes;
        
        
        $user_setting->save();

        return redirect('user_setting');
    }
107425
public function updatePassword(UpdateProfilePasswordRequest $request)
    {
        $user = $this->user->find($this->auth->id());

        $credentials = [
            'id'       => $this->auth->id(),
            'email'    => $user->email,
            'password' => $request->old_password,
        ];

        if (! $this->auth->attempt($credentials)) {
            Flash::error(trans('user::messages.invalid old password'));

            return redirect()->back();
        }

        $this->user->update($request->all(), $this->auth->id());

        flash(trans('user::messages.password updated'));

        return redirect()->back();
    }
1356848
public function update(UpdateRedirectRequest $request, $id)
    {
        $redirect = $this->redirect->findOrFail($id);
        $redirect->update($request->all());

        return redirect('admin/redirects');
    }