json([ 'success' => true, 'data' => $data, 'message' => $message, 'errors' => null, 'meta' => (object) $meta, ], $status); } /** * Standard error envelope. Use HTTP_UNPROCESSABLE_ENTITY for validation, * HTTP_NOT_FOUND for missing resources, etc. */ public static function error( string $message, mixed $errors = null, int $status = Response::HTTP_BAD_REQUEST, array $meta = [], ): JsonResponse { return response()->json([ 'success' => false, 'data' => null, 'message' => $message, 'errors' => $errors, 'meta' => (object) $meta, ], $status); } }