Skip to content

Commit de0bf9b

Browse files
authored
Document create:factory
1 parent 27e7a74 commit de0bf9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

console/scaffolding.md

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ php artisan create:model <plugin code> <model name>
5757

5858
The `create:model` command generates the files needed for a new model. The first argument specifies the plugin code of the plugin that this model will be added into, and the second parameter specifies the model class name, eg. `MyModel`.
5959

60+
## Create a factory
61+
62+
```bash
63+
php artisan create:factory <plugin code> <factory name> --model=Post
64+
```
65+
66+
The `create:factory` command generates a [Model Factory](https://laravel.com/docs/9.x/eloquent-factories#introduction) in the plugin's `database/factories` folder. The first argument specifies the plugin code of the plugin that this factory will be added into, and the second parameter specifies the name of the Factory class to generate. The `--m|model` option specifies the model that will be targeted by the factory, eg. `MyModel`.
67+
6068
## Create a settings model
6169

6270
```bash

0 commit comments

Comments
 (0)