有人可以帮助我解决这个问题吗?我尝试使用块方法根据类别获取数据,而且我使用集合。但是,当我在集合中使用Where子句时,它将给我空值。请帮助我。
$products=DB::table('stock_management')
->join('warehouse_products','stock_management.product_id','=','warehouse_products.id')
->leftjoin('brand','warehouse_products.brand_id','=','brand.id')
->select('warehouse_products.*','brand.name as Brandname','brand.remember_token as color')
->orderBy('brand.name','ASC')
->get()
->chunk(50);
$collection=collect($products);
$getProduct=$collection->where('categories_id','=',34);
$catProduct=$getProduct->all();
dd($catProduct);