spacedog4
7 months ago
282
6
Laravel

getColumnListing return empty array when it shoulnd't

Posted 7 months ago by spacedog4

I need to get all column names from a table

doing

$model->getConnection()->getSchemaBuilder()->getColumnListing($model->getTable())

or

Schema::getColumnListing($model->getTable())

even

\DB::select("select column_name as `column_name` from information_schema.columns where table_schema = 'gestor and table_name = 'controleexportacao'") // this sql works in database softwares

it returns me an empty array $model->getConnection() returns me the connection where I can see the table is there and with the columns

Debuging the getColumnListing method I got this sql select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? so I used it on another database software and it returned me all columns

So why getColumnListing dont return it?

Is important to notice that I'm using multiple database, that's why I checked the connections config

Please sign in or create an account to participate in this conversation.