Skip to content

Commit

Permalink
Update readme for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyWay committed Mar 4, 2014
1 parent 79c8523 commit 0e5b211
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,68 @@ If you say yes to each confirmation, this single command will give you boilerpla
- app/models/Post.php
- app/controllers/PostsController.php
- app/database/migrations/timestamp-create_posts_table.php (including the schema)
- app/database/seeds/PostsTableSeeder.php
- app/database/seeds/PostsTableSeeder.php

### Configuration

You may want to modify your templates - how the generated files are formatted. To allow for this, you
need to publish the templates that, behind the scenes, the generators will reference.

```bash
php artisan generate:publish-templates
```

This will copy, by default, all templates to your `app/templates` directory. You can modify these however you wish to fit your desired formatting. If you'd prefer a different directory:

```bash
php artisan generate:publish-templates --path=app/foo/bar/templates
```

Once finished, you'll need to tell the generators where your new templates are located. When you run the `generate:publish-templates` command, it will also publish
the configuration to `app/config/packages/way/generators/config/config.php`. This file will look like:

```php
<?php

return [

/**
* Where is the template for a model?
*/
'model_template_path' => 'vendor/way/generators/src/Way/Generators/templates/model.txt',

/**
* Where do you put your models?
*/
'model_target_path' => app_path('models'),

/**
* Where is the template for a migration?
*/
'migration_template_path' => 'vendor/way/generators/src/Way/Generators/templates/migration.txt',

/**
* Where do you put your migrations?
*/
'migration_target_path' => app_path('database/migrations'),

/**
* Where is the template for a database seeder?
*/
'seed_template_path' => 'vendor/way/generators/src/Way/Generators/templates/seed.txt',

/**
* Where do you put your database table seeders?
*/
'seed_target_path' => app_path('database/seeds')

];
```

For any template that you modify, update its respective `*_template_path` value. For instance:

```php
'model_template_path' => app_path('templates/model.txt')
```

Also, while you're in this file, note that you can also update the default target directory for each generator.

0 comments on commit 0e5b211

Please sign in to comment.