You can do
Route::get('location/category/subcategory/item', array('uses' => 'RestaurantController@example');
and for category
Route::get('location/category/subcategory', array('uses' => 'CategoryController@example');
Small correction on the previous comment:
Route::get('{location}/{category}/{subcategory}/{item}', function($location, $category, $subcategory, $item) {
echo "Restaurant";
var_dump($location, $category, $subcategory, $item);
});
Route::get('{location}/{category}/{subcategory}', function($location, $category, $subcategory) {
echo "Category";
var_dump($location, $category, $subcategory);
});
will give you something a bit more dynamic.
Thanks for that, I really appreciate the help. I was concerned that
{location}/{category}/{subcategory}/{item}
contains
{location}/{category}/{subcategory}
but the routes obviously have to match exactly.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community