【发布时间】:2018-08-12 05:20:49
【问题描述】:
如何在 Laravel eloquent 中使用 null 作为列值,就像下面的查询一样(下面的查询不工作,举个例子)。
$query = \DB::table('invoices as inv')
->leftjoin('customer as c', 'c.id', '=', 'inv.customer_id')
->select([
'inv.id',
'inv.invoice_date',
'inv.invoice_no',
'null as voucher_no',
'null as credit',
]);
这里,'null as coupon_no' 不起作用。如何在此查询中使用 null。
【问题讨论】: