CrestApps / laravel-code-generator

An efficient Laravel code generator, saving time by automating the creation of resources such as views, controllers, routes, migrations, languages, and form-requests. Highly flexible and customizable, it includes a cross-browser compatible template and client-side validation for application modernization.
https://laravel-code-generator.crestapps.com
MIT License
738 stars 158 forks source link

Feature Request: Allow customization of route naming conventions #92

Open shawnveltman opened 5 years ago

shawnveltman commented 5 years ago

First and foremost, I cannot express my admiration for the work everybody here is doing enough! This is an amazingly helpful project!!!

The feature request I'm suggesting is a way to customize some of the "baked in" options, specifically the route naming convention - apologies if this has been covered elsewhere.

Right now, the routes.stub file has magic methods for things like "index_route_name" and "create_route_name". Those end up defaulting out to models.model.index and models.model.show by default.

The coding style in my company is to use much sorter route names, and I'd love to be able to overwrite the current stubs to use the preferred formatting.

Thanks for considering this!

MikeAlhayek commented 5 years ago

Hi,

This could be added in future releases. However, you may be able to utilize existing options/configurations to do what you need. Can you please explain what are you trying to do here? Or how do you foresee the route name?

shawnveltman commented 5 years ago

Thanks for the quick response!

In this specific example, I'd like to ensure that the route conventions in my project are changed from "models.model.index" to just "models", and for the rest to follow the convention "model.show"/"model.edit" etc (both in the routes file, as well as in all the generated views obviously)

MikeAlhayek commented 5 years ago

How are you going to differentiate between the different actions methods on your controller? Also, what value would having a different name add to your project?

If you want to add a prefix to your existing route like for "frontend" and "backend" you would upgrate the the v2.3 which is not out yet. v2.3 gives you an option to add a prefix https://github.com/CrestApps/laravel-code-generator/blob/v2.3/src/Commands/Framework/CreateRoutesCommand.php here is v2.3 https://github.com/CrestApps/laravel-code-generator/tree/v2.3