Laravel 查询时无数据
作者:互联网
当 $address 不能存在时,则过滤数据会出现问题 address 字段为空的数据记录不返回
$guests = Guest::where('address','like','%'.$address.'%')
->where(function($query) use ($browser){
if (isset($browser)) {
$query->where('browser', 'like', '%'.$browser.'%');
}
})
->where(function($query) use ($referrer){
if (isset($referrer)) {
$query->where('referrer','like','%'.$referrer.'%');
}
})
->orderBy('created_at', 'desc')
->paginate($perPage = $pageSize, $columns = ['*'], $pageName = '', $page = $current);
标签:Laravel,like,referrer,数据,查询,address,query,where,browser 来源: https://www.cnblogs.com/winyh/p/14423648.html