Monday, April 10, 2017

Laravel Multiple Databases Use all at the same time

I am not sure if this is even possible but i have this scenario with my Laravel install.

I am running 3 live databases (will be more over time), I have one laravel installation, and what I want to do is merge all the data using the different connections and run 1 query to get all the data with all relationships etc.... basically want to use eloquent. All the database are the same in terms of table designs, index, keys etc, but I am not sure if its even possible!

The only way in which i know it will work would be doing is this way.

DB::connection('connection')->table('table_here')->get();

Anyone know if this is even possible.



via Hayden Sweet

Advertisement