Files
laravel_school_api/app/Console/Commands/LegacyUnsafeRouteAuditCommand.php
T
2026-05-30 01:11:35 -04:00

33 lines
1.2 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
final class LegacyUnsafeRouteAuditCommand extends Command
{
protected $signature = 'app:legacy-unsafe-route-audit';
protected $description = 'Audit known unsafe legacy routes that must be disabled or removed before final rollout.';
public function handle(): int
{
$items = config('release_readiness.unsafe_legacy_routes', []);
$report = [
'generated_at' => now()->toIso8601String(),
'items' => array_map(fn (string $key): array => [
'key' => $key,
'status' => 'requires_project_mapping',
'note' => 'Map this key to actual legacy route names in the real app and disable/remove before production readiness signoff.',
], $items),
];
$path = storage_path('app/generated/legacy-unsafe-route-audit.json');
File::ensureDirectoryExists(dirname($path));
File::put($path, json_encode($report, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$this->line(json_encode($report, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
return self::SUCCESS;
}
}