Laravel / Eloquent:请求中的多个条件子句

时间:2017-08-23 08:34:21

标签: php laravel laravel-5 eloquent

我正在尝试在我的请求中添加多个条件子句,但是我收到此错误:我的查询中的错误在哪里?

    (1/1) ErrorException
mb_strpos() expects parameter 1 to be string, object given

代码:

$data = Ov::with([
            'ovLicenses',
            'masters' => function ($query) use ($devicesArrayOnlyLKUAToZero) {
                $query->whereIn('macAddress', $devicesArrayOnlyLKUAToZero);
            }, function ($query) {
                $query->orWhere('lastKnownUpAt','<>', '0');
            },
            'masters.licenses',
            'masters.equipment',
            'masters.slaveEquipments.equipment',
            'wireless'=> function ($query) use ($devicesArrayOnlyLKUAToZero) {
                $query->whereIn('macAddress', $devicesArrayOnlyLKUAToZero);
            }, function ($query) {
                $query->orWhere('lastKnownUpAt','<>', '0');
            },
            'wireless.licenses',
            'wireless.equipment'
        ])->where('ovId', '=', $ovId)->get();

1 个答案:

答案 0 :(得分:0)

你有没有理由不使用

<em>