Your mean is multi database connection or multi table in a database?
@tuyenlaptrinh // As you see in my code example, I meant multiple databases. @Xum // That's multiple connections, not multiple databases.
You mean query multi database in one query for an result?
@moon0326, you can prefix database name to table name:
DB::table('dbname.tablename')->get();
if you created connections in database.php it is possible to change it onthefly with setConnection("connection_name") if you use Elouquent.
If you use DB you can do it DB::connection("connection_name")
@tuyenlaptrinh // No. I just want to query against a different D.B
@Xum // That's the one! Thank you :) @jernejrostan // Thanks. I will keep that in mind.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community