Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

psyopus's avatar

perhaps if you have a frontend that gets translation from backend for content areas? or when the api needs to returns localized error messages?

36864's avatar

Right, updating the accepted answer to clarify this for posterity.

36864's avatar

Maybe it would make sense to raise an issue over at github for this then, either a documentation change is in order or the way defaults are set needs to change, or the way redirects are handled in the auth middleware needs to change.

pawanyd's avatar

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');

}

Previous

Please or to participate in this conversation.