我的應用程序返回錯誤,我需要知道原因。我提出了一個 AJAX 請求,以獲取他在熱賣或特價商品中選擇的所有產品,并且...如果我刪除此查詢功能,它會返回數據。如何將此請求選中框傳遞給此函數?函數 App\Http\Controllers\Website\AllProductController::App\Http\Controllers\Website\{closure}() 的參數太少,1 傳入 /...../vendor/laravel/framework/src/Illuminate /Database/Eloquent/Builder.php 在第 226 行,預計正好 2public function ajax_category(Request $request) { if(isset($request->price) && isset($request->categories_id)) { $product_category = $request->categories_id; // change the value from string to array. if (isset($request->selectedbox) && $request->selectedbox !='') { $pairs = $request->selectedbox; $newArray = explode(",", $pairs); } if (!empty($request->categories_id)) { $max = $request->max; $min = $request->min; } else { $min = product_model::where('pactive', 1)->select('MIN("price")')->first(); $max = product_model::where('pactive', 1)->select('MAx("price")')->first(); } // change the value from string to array. if (!empty($request->priceRange)) { $currentRange = $request->priceRange; $priceArray = explode(",", $currentRange); $firstPrice = $priceArray[0]; $secondPrice = $priceArray[1]; } else { $firstPrice = $min; $secondPrice = $max; } $products = product_model::where('category', $request->categories_id) ->whereBetween('price', [$firstPrice, $secondPrice]); if (isset($request->selectedbox) && $request->selectedbox !='') { $products = $products->where(function ($query,Request $request) { $pairs = $request->selectedbox; $newArray = explode(",", $pairs); $query->whereIn('poffertype',implode(',', $newArray)) ->orwhereIn('brand', implode(',', $newArray)) ->orwhereIn('brand_ar', implode(',', $newArray)); }); }
- 1 回答
- 0 關注
- 136 瀏覽
添加回答
舉報
0/150
提交
取消