Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel雄辩地使用null作为select上的列值?_Php_Sql_Laravel 5 - Fatal编程技术网

Php Laravel雄辩地使用null作为select上的列值?

Php Laravel雄辩地使用null作为select上的列值?,php,sql,laravel-5,Php,Sql,Laravel 5,如何在Laravel eloquent中使用null作为列值,就像在下面的查询中一样(下面的查询不起作用,其示例为空) 此处,空为凭证\u no”不起作用。如何在此查询中使用null。在列周围使用,这将强制laravel按原样传递列名: $query = \DB::table('invoices as inv') ->leftjoin('customer as c', 'c.id', '=', 'inv.customer_id') ->select([

如何在Laravel eloquent中使用null作为列值,就像在下面的查询中一样(下面的查询不起作用,其示例为空)

此处,空为凭证\u no”不起作用。如何在此查询中使用null。

在列周围使用,这将强制laravel按原样传递列名:

$query = \DB::table('invoices as inv')
    ->leftjoin('customer as c', 'c.id', '=', 'inv.customer_id')
    ->select([
        'inv.id',
        'inv.invoice_date',
        'inv.invoice_no',
        DB::raw('null as voucher_no'),
        DB::raw('null as credit'),
    ]);
在列周围使用,这将强制laravel按原样传递列名:

$query = \DB::table('invoices as inv')
    ->leftjoin('customer as c', 'c.id', '=', 'inv.customer_id')
    ->select([
        'inv.id',
        'inv.invoice_date',
        'inv.invoice_no',
        DB::raw('null as voucher_no'),
        DB::raw('null as credit'),
    ]);