Skip to content

Commit

Permalink
Fix optionally setting locale in user API
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcage committed Mar 24, 2024
1 parent 07abe3f commit cbb687b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Update third-party libraries

### Fixed

* Fix optionally setting locale in user API

## 5.8.1 - 2024-03-07

### Changed
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/UserManagement/API/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public function store(StoreUpdateUser $request): JsonResponse
$user = new User();
$user->name = $request->validated('name');
$user->email = $request->validated('email');
if ($request->filled('locale')) {
$user->locale = $request->validated('locale');
}
$user->password = Hash::make($request->password);
$user->is_super_admin = $request->boolean('is_super_admin');
$user->save();
Expand Down Expand Up @@ -122,6 +125,9 @@ public function update(StoreUpdateUser $request, User $user): JsonResponse
{
$user->name = $request->validated('name');
$user->email = $request->validated('email');
if ($request->filled('locale')) {
$user->locale = $request->validated('locale');
}
$passwordMessage = '';
if ($request->filled('password')) {
$user->password = Hash::make($request->password);
Expand Down

0 comments on commit cbb687b

Please sign in to comment.