Php 缺少关于

Php 缺少关于,php,laravel,laravel-5,laravel-5.2,Php,Laravel,Laravel 5,Laravel 5.2,我想按价格订购产品,一个链接从低到高,另一个链接从高到低, 当我打开“content.products”页面时,我遇到了这个错误:“App\Http\Controllers\ShopController::products()缺少参数3”。 这是控制器中的功能: public function products(Request $request,$category_url,$sort){ Product::getProducts($category_url, self:: $data);

我想按价格订购产品,一个链接从低到高,另一个链接从高到低, 当我打开“content.products”页面时,我遇到了这个错误:“App\Http\Controllers\ShopController::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}','ShopController@products');
这些是来自视图的链接,视图是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>
|
更改

公共功能产品(请求$Request,$category\u url,$sort){

公共功能产品(请求$Request,$category\u url,$sort='ASC'){

这为最后一个参数提供了一个默认值

Route::get('shop/{category_url}/sorting-{sort},'ShopController@products);

Route::get('shop/{category_url}/sorting-{sort?},'ShopController@products);

使最后一个参数成为可选的url。

更改

公共功能产品(请求$Request,$category\u url,$sort){

公共功能产品(请求$Request,$category\u url,$sort='ASC'){

这为最后一个参数提供了一个默认值

Route::get('shop/{category_url}/sorting-{sort},'ShopController@products);

Route::get('shop/{category_url}/sorting-{sort?},'ShopController@products);


使最后一个参数成为可选的url。

是否有以
店铺开始的任何其他路线
?是否有以
店铺开始的任何其他路线
?谢谢,现在它不显示错误,但在单击从低到高或从高到低后,产品的顺序没有改变谢谢,现在它不显示错误,但单击“从低到高”或“从高到低”后,产品的顺序不会更改