Laravel 8 tutorial - Multiple Database Connection

preview_player
Показать описание
In this laravel 8 and laravel 9 version API tutorial, we learn how to make multiple database connections in laravel with a simple way. This video is made by anil Sidhu in the English language.

Multiple DB Connection
DB config
Make Controller and Model
Multiple DB with Query Builder
Multiple DB with Model
Interview Question

Рекомендации по теме
Комментарии
Автор

Please support me by subscribe, like and comment :) thank you

codestepbystep
Автор

Yes, it's possible as long as they are on the same server, for example: $result = \DB::table('db1. users') ->join('db2. users', 'db2.users.id', '=', 'db1.users.id') ->select('db1.users.id', 'db2.user.id');

ektapatel_
Автор

SQL Server allows you to join tables from different databases as long as those databases are on the same server. The join syntax is the same; the only difference is that you must fully specify table names

laibagillani
Автор

is it possible to connect live server database to local server like xampp?

sandipbamaniya
Автор

Yes it is possible just use the db name with both of the tables. Like:
Return Model_name::join('db1.tablename', 'db2.tablename.id', '=', 'db1.tablename.id')
->select('tablename.*)
->get();

tariqkhan
Автор

yes joins can be applied on different databases as well

saikumarkandikonda
Автор

I am having ERP software in laravel, I have 100+database in it , each organisation have different database how to create 100+ database for ERP, any solution is having for this problem, please help me to solve this

skymatrix
Автор

so good bro, but i need see the Divice model please(the estructure) thansk..

DevsSebas
Автор

is this possible second connection from another server database?

manishakoladara
Автор

JOIN can apply on tables with in the same DB

syedrizvi
Автор

Hey Anile. Can Laravel connect to two databases in different servers?

ahangkhaneh
Автор

I think that joins can only apply on same data base

hariprasadhari
Автор

Aik database ma agr multiple tables bna rahy hy to ksay kry gy

zoyamalik
Автор

there are many problems
1- create one migrations table for all databases not create one for each
2- any migration for any database add it in migrations table in mysql driver example (create table students in mysql2 migration recored in migrations table in mysql not mysql2 🙃
3- if you try build relation through another table belogns to different database driver not work
4- php artisan migrate:fresh give table exisits but not drop from second database

enas
Автор

What if there is a different username on each database?

eloircasas
Автор

but how to join databases tables 🤔 any solution

TusharZambare
Автор

Sir I’m not able to get data by using model

mitalgal
Автор

Hi sir. I got an Error
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO) (SQL: select * from `users`)

dannielmagano
Автор

Call to undefined method
getting this error

SH-oevl
Автор

Hello bro, can you open your telegram? I want to buy these tools.

melaniefisher