mercredi 21 octobre 2015

Laravel Route with n parameters

I have categories and each category can have subcategories.

So I have this route:

Route::get('category/{param1}/{param2?}', 'CategoryController@show');

But what when a child category also has subcategories and so on? Is there a way to do it without hardcoding the number of possible subs?

For the controller I could use the splat operator like this:

public function show(...$param) {

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire