Laravel-4-Generators icon indicating copy to clipboard operation
Laravel-4-Generators copied to clipboard

Suggestion - Configuration of templates

Open dimitardanailov opened this issue 11 years ago • 6 comments

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

dimitardanailov avatar May 05 '14 09:05 dimitardanailov

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',
...

vladshcherbin avatar May 05 '14 10:05 vladshcherbin

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.

dimitardanailov avatar May 05 '14 14:05 dimitardanailov

Fine with it, if somebody wants to submit a pull request.

laracasts avatar May 08 '14 00:05 laracasts

To me templates should be published in config/packages/way/generators or something, they feel kind of out of places in app/templates

Anahkiasen avatar May 09 '14 16:05 Anahkiasen

You can override the save location.

laracasts avatar May 12 '14 21:05 laracasts

No I know, I'm talking default here.

Anahkiasen avatar May 13 '14 07:05 Anahkiasen