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);