I use DB::setDatabaseName(<database name>)
to reset the databasename, then I use DB::table(<table name>)->get()
to retrieve data. However laravel does not change to new database.
This is my error message:
Illuminate/Database/QueryException with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "t" does not exist LINE 1: select * from "t" ^ (SQL: select * from "t")'
The table t
is in another database. I think when I use DB::setDatabaseName(<database name>)
it would work.
Thank you for your help!