schneespur/app/Console/Commands/ModulesList.php
Michael 2c63440ed8 Revert: move code back to project root from schneespur/ subdirectory
- Reverts the schneespur/ subdirectory restructure (b8e426b)
- Restores package.json and vite.config.js (needed for npm build, were
  removed in an earlier cleanup before the restructure)
- Updates public/build/ assets with current Vite output (new content hashes)
2026-05-17 18:24:26 +00:00

52 lines
1.4 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Models\Module;
use App\Services\SchneespurModuleClient;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
class ModulesList extends Command
{
protected $signature = 'schneespur:modules-list';
protected $description = 'List all installed modules with their state.';
public function handle(SchneespurModuleClient $client): int
{
if (! Schema::hasTable('modules')) {
$this->info('Keine Module installiert.');
return 0;
}
$modules = Module::orderBy('slug')->get();
if ($modules->isEmpty()) {
$this->info('Keine Module installiert.');
return 0;
}
$rows = $modules->map(fn (Module $m) => [
$m->slug,
$m->version ?? '—',
$m->enabled ? '✓' : '✗',
$m->installed_at?->format('Y-m-d H:i') ?? '—',
])->toArray();
$this->table(['Slug', 'Version', 'Aktiv', 'Installiert am'], $rows);
$state = $client->loadState();
$orphans = $state['orphans'] ?? [];
if (! empty($orphans)) {
$this->newLine();
$this->warn('Verwaiste Module (nicht mehr im Katalog):');
foreach ($orphans as $slug) {
$this->warn("{$slug}");
}
}
return 0;
}
}