Question

I dont know how to configure routing class to route this in one index method:

categories/176
categories/?depth=3&category=4

first URL is for one category, the second one is for list of categories (filtered by depth and category parameter).

I have class Categories with this method:

/**
* @smart-auto-routing false
*/
public function index($category_id) {
}

OK, this works for categories/176 but how can I add categories/?depth=3&category=4 routing to this index method?

Was it helpful?

Solution

Class Categories
{

    public function index($depth=3, $category=4) {
        //categories?depth=3&category=4 received here
        //since they have default values we can call
        //categories with out any query param too!
    }

    public function get($id){
        //categories/176 received here
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top