Laravel best practice is not putting logic into a route file.
This is pretty obvious and right.
But does this only refer to not using the SRP and to not delegating the request to properly build classes (controllers, services, fat models and so on)?
Or does this also exclude some kind of queries and loops inside your route file in order to write less code?
For example in a CMS or admin backend scenario where you have to generate a lot of similar (ressource) routes for CRUD models which names you can get from a config file or database query.
Some pseudo code for explanation:
// routes/web.php
foreach(getModelNames() as $name) {
Route::resource(calculateRouteName($name), calculateControllerName($name));
}
So is this a good idea as route files can be cached or a bad one?