【发布时间】:2017-09-15 13:09:40
【问题描述】:
当我设置了一个使用两个数据库的“.env”时,还编写了如下代码以供使用。
但是 where() 方法使用不正确。
你能告诉我更详细的使用 where() 方法的用法和解释或告诉我一些学习的链接吗?
感谢您。
$master = DB::connection('master_db')->table('customer_master')
->where(['name', '=', 'string'],
['tel', '=', 'integer'],
['address','=', 'string']);
$slave = DB::connection('slave_db')->table('customer_slave')
->where(['histories', '=', 'string'])
->union($master)
->get();
【问题讨论】:
-
不确定你在问什么,虽然我以前从未见过 where() 使用的数组语法,但它看起来是正确的。您可以使用
->toSql()和->getBindings()转储 SQL 和绑定以检查查询本身。
标签: database laravel laravel-facade