关于laravel where语句的 模糊查询

$good = DB::table('goods')
->join('category', 'goods.category_id', '=', 'category.id')
->join('provider', 'goods.provider_id', '=', 'provider.id')
->join('brand', 'goods.brand_id', '=', 'brand.id')
->join('unit', 'goods.unit_id', '=', 'unit.id')
->select('goods.*', 'category.category_name', 'provider.company_name','brand.brand_name','unit.unit_name')
->orwhereBetween('goods.price' ,[$data['min'],$data['max']])
->orwhereBetween( 'goods.created_at',[$data['mintime'],$data['maxtime']])
->orwhere('goods.type' ,$data['type'])
->orwhere('goods.category_id',$data['category_id'])
->orwhere('goods.provider_id',$data['provider_id'])
->orwhere('goods.name','like',$data['name'])
-> get();

关于上述 like 模糊查询问题

如果在加上%(如下)
->orwhere('goods.name','like','%'.$data['name'].'%')
可以进行模糊查询 但是其他查询语句失效
求解
已邀请:

猴子真的会偷桃

赞同来自:

建议你去看看ORM。别用DB了

要回复问题请先登录注册