$cooperative_attributes = request()->input('cooperative_attributes','');
$cooperative_attributes = $cooperative_attributes ? explode(',',$cooperative_attributes) : [];
->when($cooperative_attributes,function($q) use ($cooperative_attributes){
$q->where(function($query) use ($cooperative_attributes){
foreach($cooperative_attributes as $key=>$val){
if($key == 0){
$query->whereRaw('FIND_IN_SET(?,cooperative_attributes)',$val);
}else{
$query->orWhereRaw('FIND_IN_SET(?,cooperative_attributes)',$val);
}
}
});
})
laravel查询以,隔开的字段和以,隔开的参数
最新推荐文章于 2024-09-15 23:43:07 发布