Skip to content

Commit 6a68403

Browse files
committed
Update README
1 parent 6a178cb commit 6a68403

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`php artisan generate:model-factory`
44

5-
This package helps you generate model factories from your existing models / database structure to get started with testing your Laravel application even faster.
5+
This package will generate [factories](https://laravel.com/docs/master/database-testing#writing-factories) from your existing models so you can get started with testing your Laravel application more quickly.
66

77
### Example output
88

@@ -48,25 +48,24 @@ $factory->define(App\User::class, function (Faker\Generator $faker) {
4848
Require this package with composer using the following command:
4949

5050
```bash
51-
composer require mpociot/laravel-test-factory-helper
52-
```
53-
Go to your `config/app.php` and add the service provider:
54-
55-
```php
56-
Mpociot\LaravelTestFactoryHelper\TestFactoryHelperServiceProvider::class
51+
composer require --dev mpociot/laravel-test-factory-helper
5752
```
5853

5954
### Usage
6055

61-
Just call the artisan command:
56+
To generate multiple factories at once, run the artisan command:
6257

6358
`php artisan generate:model-factory`
6459

65-
This command will look for all models in your "app" folder (configurable by using the `--dir` option) and create test factories and save them in your `database/factories/ModelFactory.php`.
60+
This command will find all models within your application and create test factories. By default, this will not overwrite any existing model factories. You can _force_ overwriting existing model factories by using the `--force` option.
61+
62+
To generate a factory for specific model or models, run the artisan command:
63+
64+
`php artisan generate:model-factory User Team`
6665

67-
The output filename is also configurable by using the `--filename` option.
66+
By default, this command will search under the `app` folder for models. If your models are within a different folder, for example `app/Models`, you can specify this using `--dir` option. In this case, run the artisan command:
6867

69-
By default, the command will only append new models and doesn't modify the existing content of your factories file. To rewrite the file, use the `--reset` option.
68+
`php artisan generate:model-factory --dir app/Models -- User Team`
7069

7170
### License
7271

0 commit comments

Comments
 (0)