How to force Laravel ORM to connect to the write DB? 發表於 2020-12-23 更新於 2021-02-07 Disqus: laravel ORM 讀寫分離的 db ,如何強迫取得來自 write db 的資料?讓 ORM 讀寫入的那一台 DBModel::onWriteConnection()... 讓 join 的 table,也讀寫入的那台 DB123->with(['joined_table' => function ($query) { $query->useWritePdo();}]) 組合123Model::onWriteConnection()->with(['joined_table'=>function($query){ $query->useWritePdo();}])->find($id); 參考資料 https://stackoverflow.com/questions/39347718/eloquent-pre-loading-relationships-against-db-write-connection