mardi 10 septembre 2019

Get list table name of configured connection in Laravel with Doctrine

I've a app with more one connection. One connection for each database.

I need to pick up the list of tables using Doctrine

DB::connection()->getDoctrineSchemaManager()->listTableNames()
// Also try this
dd(DB::connection('name_of_connection_in_database_config')->getDoctrineSchemaManager()->listTableNames())

Also try this

$sm = Schema::connection('name_of_connection_in_database_config');
dd($sm->getAllTables());

But this code only get tables of default connection instead tables of database selected.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire