1
小套牢參數,市場和排序傳遞可選參數是可選的不打電話來正確的
Route::get('Category/{title}/{market?}/{sort?}', '[email protected]');
但是,當我在URI
網址做到這一點:?類別/標題/排序= 3
它不註冊爲3排序,但在去隨着市場paramater
當然如果URI是類別/標題/ Makert/3將返回我想要什麼
public function productList($title, $market = null, $sort = null)
{
// Gets the Categories with its Markets
$categorys= Product::cats();
$brands = Product::CategoryWithMarket($title, $market)->groupBy('Brand')->get();
$subCat = Product::where('Category', $title)->groupBy('Market')->orderBy('Market', 'ASC')->get();
if (!$market) {
$marketList = Product::where('Category', $title)->orderBy('Brand', 'ASC')->orderBy('Label', 'ASC')->paginate(15);
$brands = Product::where('Category', $title)->groupBy('Brand')->orderBy('Brand', 'ASC')->get();
$mainTitle = ucfirst($title);
}
else {
// Gets the list of products with the catery and market attributes arranged by the brand of product
$marketList = Product::CategoryWithMarket($title, $market)->paginate(15);
$mainTitle = ucfirst($title) . ' ' . ucfirst($market) ;
}
return $sort;
在初論應該傳回的排序參數是3,但它不返回任何東西,所以我的問題是如何獲得排序返回其值3,而不是空
哦,好的,我現在看到的感謝你這麼多 –