mardi 31 mai 2016

Laravel Read/Write Connection - Specify Explicitly

I am trying to configure master/slave db connection in a handy way. The cleaner way I came across is using read/write hosts separately in database config file.

'mysql' => [
'read' => [
    'host' => '192.168.1.1',
],
'write' => [
    'host' => '196.168.1.2'
],
'driver'    => 'mysql',
'database'  => 'database',
'username'  => 'root',
'password'  => '',
'charset'   => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix'    => '',
],

In some cases, I need to read the data from master db (without replication lag). Is there a way to specify this explicitly? Something like we pass connection name to connection() method?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TVkG9k
via IFTTT

Aucun commentaire:

Enregistrer un commentaire