make(Illuminate\Contracts\Console\Kernel::class); $kernel->bootstrap(); use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\DB; $tabs = ['ripartizioni_preventivo', 'ripartizioni_spese', 'dettaglio_ripartizione_spese']; foreach ($tabs as $t) { if (Schema::hasTable($t)) { echo "Table $t count: " . DB::table($t)->count() . "\n"; $first = DB::table($t)->limit(3)->get(); print_r($first); } else { echo "Table $t does not exist.\n"; } }