Check that the user exists before trying to fill the request

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-27 14:05:28 +01:00
parent 422f3ec81e
commit 55c98cc27a

View file

@ -437,7 +437,9 @@ class UsersController extends Controller
{
$this->authorize('update', User::class);
$user = User::find($id);
if ($user = User::find($id)) {
$this->authorize('update', $user);
/**
@ -510,6 +512,10 @@ class UsersController extends Controller
return response()->json(Helper::formatStandardApiResponse('error', null, $user->getErrors()));
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/users/message.user_not_found', compact('id'))));
}
/**
* Remove the specified resource from storage.
*