Laravel Database: Read & Write Connections
'mysql' => [
'read' => [
'host' => ['192.168.1.1'],
],
'write' => [
'host' => ['196.168.1.2'],
],
'sticky' => true,
'driver' => 'mysql',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
], The proper connections will always be used whether you are using raw queries, the query builder, or the Eloquent ORM.
The sticky Option
Related concepts
→
Read & Write Connections
→
Semantic portal