- Include analytics_slug in apiRedirects() query - Fix missing analytics_slug in Vue.js data - Ensure analytics links appear in redirects list
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
// Script para testar se a API está a retornar analytics_slug
|
|
require_once 'config.php';
|
|
|
|
use App\Modules\Redirects\Models\RedirectModel;
|
|
|
|
try {
|
|
$model = new RedirectModel();
|
|
$redirects = $model->getAll();
|
|
|
|
echo "🔍 Testando API de redirects...\n\n";
|
|
echo "📊 Total de redirects: " . count($redirects) . "\n\n";
|
|
|
|
if (!empty($redirects)) {
|
|
$first = $redirects[0];
|
|
echo "📋 Primeiro redirect:\n";
|
|
echo "ID: {$first['id']}\n";
|
|
echo "Nome: {$first['name']}\n";
|
|
echo "CUID: {$first['cuid']}\n";
|
|
echo "Analytics Slug: " . ($first['analytics_slug'] ?? 'NULL') . "\n";
|
|
|
|
// Verificar se todos têm analytics_slug
|
|
$withoutSlug = 0;
|
|
foreach ($redirects as $redirect) {
|
|
if (empty($redirect['analytics_slug'])) {
|
|
$withoutSlug++;
|
|
}
|
|
}
|
|
|
|
echo "\n📈 Redirects sem analytics_slug: {$withoutSlug}\n";
|
|
|
|
if ($withoutSlug > 0) {
|
|
echo "⚠️ PROBLEMA: Alguns redirects não têm analytics_slug!\n";
|
|
} else {
|
|
echo "✅ Todos os redirects têm analytics_slug!\n";
|
|
}
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "❌ Erro: " . $e->getMessage() . "\n";
|
|
}
|