How to implement dynamic routing in Laravel?

Hi experts Laravel!
I want to start using this convenient framework, but holding back for one thing: I don't see the beautiful ways to realize the dynamic of ranting so that they can be load from the database.
Let me explain: looking for a way to move the project from a closed framework where routing is built around a multidimensional array (ie the page tree of the site lies in the mountains). It is very convenient because it allows to easily implement inheritance of all properties of the pages down the tree - the lack of simple RecursiveArrayIterator.
I would like to transfer this approach in laravel, ie to be inheriting properties from parent - child (including access rights) and store it all in the database, since the site is managed from the admin area (create tree, assign access rights, templates, pages, etc.).

Prompt where to dig?
July 8th 19 at 11:20
1 answer
July 8th 19 at 11:22
I did
Route::any('{page}', 'PageHandlerController@handle')->where('page', '^(?!admin).*');

Where the controller is fetched from the database the desired page. Something like this:

class Controller extends PageHandlerController
{
 public function handle($page)
{
 $page = CustomPage::where('url', $page)->first();

 if (!$page) {
abort(404);
}

 // do here all we want
 }
Thanks as the variant can approach. In this case, however, lose the parsing parameters.. - Wilmer_Moore commented on July 8th 19 at 11:25
What prevents a route to specify the parameters?
Route::any('{page}/{?param1}/{?param2}/{?param3}', 'PageHandlerController@handle')->where('page', '^(?!admin).*');

public function handle($page, $param1 = null, $param2 = null, $param3 = null) {}
- Aliyah.Feest commented on July 8th 19 at 11:28
it is impossible in this case to use named parameters, which could be related to models, because different pages have different set of parameters (in the database specified what).
And share the url on the slash - no problem. - Wilmer_Moore commented on July 8th 19 at 11:31

Find more questions by tags LaravelPHP