Forum Laravel How to connect 2 different databases and Join 2 tables that are on different servers?
I have 2 different databases and I want to inner join 2 tables in these databases.
I know that this is not the best practice but I need to find a way to do this with LARAVEL.
I can do this with plain PHP by opening 2 connectios. But I am looking for way to do this with laravel.
$users = DB::connection('mysql2')->select(...);'
Adding another connection is the solution but how I will use two databases in 2 different servers in 1 inner join query?
Please sign in or create an account to participate in this conversation.
There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!
Get Started
How to connect 2 different databases and Join 2 tables that are on different servers?
I have 2 different databases and I want to inner join 2 tables in these databases.
I know that this is not the best practice but I need to find a way to do this with LARAVEL.
I can do this with plain PHP by opening 2 connectios. But I am looking for way to do this with laravel.
$users = DB::connection('mysql2')->select(...);'
Adding another connection is the solution but how I will use two databases in 2 different servers in 1 inner join query?