Laravel-4-Generators
Laravel-4-Generators copied to clipboard
Suggestion - Configuration of templates
Hi Jeffrey,
I will made some changes into your template configuration. Example for current configuration:
'/Users/jeffreyway/Desktop/generators-testing/app/templates/model.txt', 'scaffold_model_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/scaffolding/model.txt', 'controller_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/controller.txt', 'scaffold_controller_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/scaffolding/controller.txt', 'migration_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/migration.txt', 'seed_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/seed.txt', 'view_template_path' => '/Users/jeffreyway/Desktop/generators-testing/app/templates/view.txt', /* |-------------------------------------------------------------------------- | Where the generated files will be saved... |-------------------------------------------------------------------------- | */ 'model_target_path' => app_path('models'), 'controller_target_path' => app_path('controllers'), 'migration_target_path' => app_path('database/migrations'), 'seed_target_path' => app_path('database/seeds'), 'view_target_path' => app_path('views') ``` ]; I think this configuration is unused, when two or more people work into an some project. I hope this configuration is more flexible: app_path('/templates/model.txt'), ``` 'scaffold_model_template_path' => app_path('/templates/scaffolding/model.txt'), 'controller_template_path' => app_path('/templates/controller.txt'), 'scaffold_controller_template_path' => app_path('/templates/scaffolding/controller.txt'), 'migration_template_path' => app_path('/templates/migration.txt'), 'seed_template_path' => app_path('/templates/seed.txt'), 'view_template_path' => app_path('/templates/view.txt'), /* |-------------------------------------------------------------------------- | Where the generated files will be saved... |-------------------------------------------------------------------------- | */ 'model_target_path' => app_path('models'), 'controller_target_path' => app_path('controllers'), 'migration_target_path' => app_path('database/migrations'), 'seed_target_path' => app_path('database/seeds'), 'view_target_path' => app_path('views') ``` ];
Hi, dimitardanailov
Actually, you can set your path with
php artisan generate:publish-templates --path=app/templates
so it will generate you the path w/o user, etc.
The output will be:
...
'model_template_path' => 'app/templates/model.txt',
'scaffold_model_template_path' => 'app/templates/scaffolding/model.txt',
...
Yes, I know this command. But now we working two guys with different OS architecture. I use Maverick and my colleague use Ubuntu. After two or three days into this project will come maybe 3 - 4 people and I want this guys/girls to use only git clone.
I suggest for: php artisan generate:publish-templates - To use my setup.
Of course this is only suggestion. I think statics route for configurations is bad idea. If you decide to change my local folder I must to change again this configuration.
Note: If you want you can close this issue. This is not an issue, this only suggestion.
Fine with it, if somebody wants to submit a pull request.
To me templates should be published in config/packages/way/generators or something, they feel kind of out of places in app/templates
You can override the save location.
No I know, I'm talking default here.