check status code in error response laravel code example Example: laravel response json status 500 return response()->json(['message' => 'error message'], 500);