I have a Laravel 5.2 project with a DB master-slave setup. When running something like Model::onWriteConnection()->with('relationship')->find($id)
, only the find()
query is run against the write connection; the with()
query is still run against a slave.
This particular query must be run against the master connection, since the relevant data may not have been replicated to the slaves yet.
Is there a way to force all parts of the eloquent query to run against the write connection?