I have the following table: group_pages in mysql database with page name route name :
id name route
--------------------
0 About about
We can make dynamic route by this way
// Instanciate a router class.
$router = app()->make('router');
Get Route value from Database
// For route path this can come from your database.
$paths = ['path_one','path_two','path_three'];
Then iterate the value to make dynamic route
// Then iterate the router "get" method.
foreach($paths as $path){
$router->resource($path, 'YourController');
}
You can use GET|POST|PUT|PATCH|DELETE methods also
// Then iterate the router "get" method.
foreach($paths as $path){
$router->get($path, 'YourController@index')->name('yours.index');
}