$limit, 'offset' => $offset, 'search' => $search, 'order' => $order, 'dir' => $dir, ]); $defaultTenantId = SettingService::getDefaultTenantId(); $defaultPrimaryColor = SettingService::getAppPrimaryColor() ?? '#2fa4a4'; $rows = []; foreach ($result['rows'] as $row) { $tenantId = (int) ($row['id'] ?? 0); $primaryColor = (string) ($row['primary_color'] ?? ''); $useDefaultColor = $primaryColor === ''; $rows[] = [ 'id' => $row['id'] ?? null, 'uuid' => $row['uuid'] ?? '', 'is_default' => $tenantId > 0 && $defaultTenantId === $tenantId, 'description' => $row['description'] ?? '', 'status' => $row['status'] ?? 'active', 'primary_color' => $useDefaultColor ? $defaultPrimaryColor : $primaryColor, 'primary_color_is_default' => $useDefaultColor ? 1 : 0, 'created' => dt($row['created'] ?? ''), 'modified' => dt($row['modified'] ?? ''), ]; } Router::json([ 'data' => $rows, 'total' => $result['total'] ?? 0, ]);