diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 4a243c7cb1..dcd18e4498 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -505,22 +505,11 @@ class UsersController extends Controller $user = User::findOrFail($id); if (empty($user->email)) { - return response()->json( - [ - 'status' => 'error', - 'message' => 'This user has no email set.', - 'payload' => null, - ], 404); + return response()->json(Helper::formatStandardApiResponse(‘error’, $accessory, trans('admin/accessories/message.inventorynotification.error'))); } - - $user->notify((new CurrentInventory($user))); - - return response()->json( - [ - 'status' => 'success', - 'message' => 'The user was notified about his current inventory.', - 'payload' => null, - ], 200); + + return response()->Helper::formatStandardApiResponse('success', $accessory, trans('admin/accessories/message.inventorynotification.success')); + } /** diff --git a/resources/lang/en/admin/accessories/message.php b/resources/lang/en/admin/accessories/message.php index a356463064..5cbfdeb43a 100644 --- a/resources/lang/en/admin/accessories/message.php +++ b/resources/lang/en/admin/accessories/message.php @@ -31,6 +31,11 @@ return array( 'error' => 'Accessory was not checked in, please try again', 'success' => 'Accessory checked in successfully.', 'user_does_not_exist' => 'That user is invalid. Please try again.' + ), + + 'inventorynotification' => array( + 'error' => 'This user has no email set.', + 'success' => 'The user has been notified about their current inventory.' )