我想訂購產品的價格與一個鏈接從低到高,另一個由高到低, ,我得到這個錯誤:「應用程序\ Http \ Controllers \ ShopController ::產品缺少參數3 ()「當我打開'content.products'時,頁面。 這是在控制器中的功能:缺失的參數3
public function products(Request $request,$category_url,$sort){
Product::getProducts($category_url, self:: $data);
if ($category1 = Categorie::where('url', '=', $category_url)->first()) {
$products = Product::where('categorie_id', $category1->getAttribute('id'))->orderBy('price', $sort)->get();
return view('content.products', self::$data , compact('products', 'sort'));
}
}
這是路由:
Route::get('shop/{category_url}/sorting-{sort}','[email protected]');
那些是從視圖的鏈接,該視圖是content.products
<a href=" {{ url('shop/'.$category['url'].'/sorting-asc')}}"
style="color:black"> High to low</a> |
<a href=" {{ url('shop/'.$category['url'].'/sorting-desc')}}" style="color:black">Low to high</a>
您是否有其他路線以「shop」開頭? – aynber