Answer the question
In order to leave comments, you need to log in
Multiple databases in one Laravel application?
Hello. When developing the project, I ran into one problem:
There is 1 site, in which we must receive both data from the site database and from other databases. Is it possible to implement this using Laravel without dancing with a tambourine? The databases are on different servers.
The docs only describe how to make read / write requests, although I don’t understand something like that.
Just in case, I will prescribe the algorithm for obtaining data:
1. We go to the user profile on the site
2. First, we get data from the site database about the user
3. When choosing additional. settings (drop-down list), we get other data from another database.
4. We display all this on the page.
There is one more option how to implement it, but in my opinion it's a bicycle - several laravel api applications that, upon request, will issue certain data from the database.
How would you solve this problem? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Database Connectionhttps://laravel.com/docs/5.7/eloquent
By default, all Eloquent models will use the default database connection configured for your application. If you would like to specify a different connection for the model, use the $connection property
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question