I would like to ask, if is possible to get something like dynamic routes in Laravel. I have a personal CMS, based on modules. Each module == controller. In database, I have a table called "structure", where are stored all subsites of page. The name of item should be any, so I don't know the name of the item, because it is based on user's wishes. So article module should be named as "news", "articles", "blog" etc. I don't know. It means, I can't set the route to exact word, cause its name could be anything. This is, why I have stored this data to database. In database I have also module_name, which will point to controller.
So, if user will set for example: Blog -> module Article, I need to get route from db like this:
Route::get('/Blog/', 'ArticleController@index'); Both "Blog" and "Article" are stored in DB.
My problem is, I am unable to retrieve this data from DB. How should I do that, from the view of "best practices"? I tried to write
use DB; in top of routes/web.php, but it doesn't work. And I also think, this is code ballast.
If anyone can help me with this, I would be thankfull. Thank you