I am trying to establish a read / write connection in Laravel 4.2.6, and I cannot perform INSERT, but I can do UPDATE and DELETE transactions. The message I get:
SQLSTATE[25006]: Read only sql transaction: 7 ERROR: cannot execute INSERT in a read-only transaction
Database Configuration:
'connections' => [
'pgsql' => [
'read' => [
'host' => '192.168.22.10'
],
'write' => [
'host' => '192.168.33.10'
],
'driver' => 'pgsql',
'database' => 'simpo',
'username' => 'postgres',
'password' => 'xxx',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
]
I am using Postgres 9.3 with 2 servers (virtual machines). Replication works fine and is a simple binary or "hot standby" replication (Master / Slave), where the rack on the machine can only perform a read operation.
EDIT:
I tested using the query builder, and INSERT works fine, but with an Eloquent error.
, , , BUG Eloquent, , INSERT , UPDATE DELETE, , , , INSERT (, , ?)
2:
. , Laravel . - , "select", select "INSERT... return" ID "", , SELECT , SELECT INSERT.
pull, , "", ,
https://github.com/laravel/framework/pull/4914