user); } public function update(ProfileUpdateRequest $request) { static::disableInDemo(Response::HTTP_NO_CONTENT); throw_unless( $this->hash->check($request->current_password, $this->user->password), ValidationException::withMessages(['current_password' => 'Invalid current password']) ); $data = $request->only('name', 'email'); if ($request->new_password) { $data['password'] = $this->hash->make($request->new_password); } $this->user->update($data); $response = UserResource::make($this->user)->response(); if ($request->new_password) { $response->header( 'Authorization', $this->tokenManager->refreshApiToken($request->bearerToken() ?: '')->plainTextToken ); } return $response; } }