| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/client-portal-laravel/current/scripts/util/ |
Upload File : |
#!/usr/bin/env php
<?php
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
use App\Models\AuditLibrary\AuditTemplate;
$templateId = $argv[1] ?? 222;
$template = AuditTemplate::with(['sections.items'])->find($templateId);
if (! $template) {
echo "Template {$templateId} not found\n";
exit(1);
}
echo "Template: {$template->name}\n";
echo "Sections: {$template->sections->count()}\n\n";
foreach ($template->sections as $section) {
$items = $section->items;
$topLevel = $items->whereNull('item_group_id')->whereNull('parent_item_id');
echo " Section: {$section->name}\n";
echo " items_count (DB): {$section->items_count}\n";
echo " actual items: {$items->count()}\n";
echo " top-level items: {$topLevel->count()}\n";
echo ' item_group_id values: '.$items->pluck('item_group_id')->filter()->unique()->implode(', ')."\n";
echo ' parent_item_id values: '.$items->pluck('parent_item_id')->filter()->unique()->implode(', ')."\n";
echo "\n";
}