First Commit

This commit is contained in:
marco
2026-09-01 10:46:29 -03:00
commit bf96b77e9c
10000 changed files with 3508600 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Console\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Illuminate\Database\Capsule\Manager as Capsule;
use Symfony\Component\Console\Helper\Table;
class DbShowCommand extends Command
{
protected static $defaultName = 'db:show';
protected static $defaultDescription = 'Exibe informações sobre o banco de dados';
protected function execute(InputInterface $input, OutputInterface $output): int
{
$connection = Capsule::connection();
$dbName = $connection->getDatabaseName();
$output->writeln("<info>Banco de Dados: {$dbName}</info>");
$output->writeln("Driver: " . $connection->getDriverName());
$tables = $connection->select('SHOW TABLE STATUS');
$table = new Table($output);
$table->setHeaders(['Tabela', 'Engine', 'Rows', 'Size (MB)', 'Collation']);
foreach ($tables as $t) {
$size = round(($t->Data_length + $t->Index_length) / 1024 / 1024, 2);
$table->addRow([
$t->Name,
$t->Engine,
$t->Rows,
$size,
$t->Collation
]);
}
$table->render();
return Command::SUCCESS;
}
}