I have a problem when when I get order list. This is outside the WHERE IN clause in Laravel. How can I decide this problem?
I use array_chank to split array for some parts and use each one with different WHERE IN.
$data = [];
$total_price_orders = 0;
$prod_controller = new ProductController();
$promocode_controller = new CouponController();
$orderQuery = Order::query();
$products = new OrderProductController();
if ($request->has('vydavnytstvo')) {
$publishHousesVal = $request['vydavnytstvo'];
$publishHousesName = [];
foreach ($publishHousesVal as $item){
$house = DB::table('properties')->where('id', $item)->pluck('value')->toArray();
$publishHousesName[] = $house;
}
$productsArray = DB::table('products')->whereIn('publishing_house', $publishHousesName)->pluck('id')->toArray();
$orders = DB::table('order_product')->whereIn('product_id', $productsArray)->pluck('order_id')->toArray();
// $orderQuery->whereIn('id', $orders);
foreach (array_chunk($orders, 1000) as $array){
$orderQuery->whereIn('id', $array);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire