diff --git a/seeding.md b/seeding.md index f0b40d9499a..5328c9ce78c 100644 --- a/seeding.md +++ b/seeding.md @@ -9,14 +9,14 @@ ## Introduction -Laravel includes a simple method of seeding your database with test data using seed classes. All seed classes are stored in the `database/seeds` directory. Seed classes may have any name you wish, but probably should follow some sensible convention, such as `UsersTableSeeder`, etc. By default, a `DatabaseSeeder` class is defined for you. From this class, you may use the `call` method to run other seed classes, allowing you to control the seeding order. +Laravel includes a simple method of seeding your database with test data using seed classes. All seed classes are stored in the `database/seeds` directory. Seed classes may have any name you wish, but probably should follow some sensible convention, such as `UserSeeder`, etc. By default, a `DatabaseSeeder` class is defined for you. From this class, you may use the `call` method to run other seed classes, allowing you to control the seeding order. ## Writing Seeders To generate a seeder, execute the `make:seeder` [Artisan command](/docs/{{version}}/artisan). All seeders generated by the framework will be placed in the `database/seeds` directory: - php artisan make:seeder UsersTableSeeder + php artisan make:seeder UserSeeder A seeder class only contains one method by default: `run`. This method is called when the `db:seed` [Artisan command](/docs/{{version}}/artisan) is executed. Within the `run` method, you may insert data into your database however you wish. You may use the [query builder](/docs/{{version}}/queries) to manually insert data or you may use [Eloquent model factories](/docs/{{version}}/database-testing#writing-factories). @@ -82,9 +82,9 @@ Within the `DatabaseSeeder` class, you may use the `call` method to execute addi public function run() { $this->call([ - UsersTableSeeder::class, - PostsTableSeeder::class, - CommentsTableSeeder::class, + UserSeeder::class, + PostSeeder::class, + CommentSeeder::class, ]); } @@ -99,7 +99,7 @@ Now you may use the `db:seed` Artisan command to seed your database. By default, php artisan db:seed - php artisan db:seed --class=UsersTableSeeder + php artisan db:seed --class=UserSeeder You may also seed your database using the `migrate:fresh` command, which will drop all tables and re-run all of your migrations. This command is useful for completely re-building your database: