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

The sticky Option — Is an optional value that can be used to allow the immediate reading of records that have been written to the database during the current request cycle.

Laravel Database: Read & Write Connections — Structure map

Clickable & Draggable!

Laravel Database: Read & Write Connections — Related pages: