Running Artisan command for a specific seeder

Step 01: Specifying migration definition of comments table

Schema::create('comments', function (Blueprint $table) {
   $table->id();
$table->text('comment_text');
$table->timestamps(); });


Step 02
: Specifying data definition of CommentFactory.php

use App\Models\Comment;

protected $model = Comment::class;

public
function definition() { return [ 'comment_text' => $this->faker->text(500), ]; }


Step 03: Specifying CommentSeeder.php

use App\Models\Comment;

public
function run() { Comment::factory(50000)->create(); }


Step 04: Running artisan command for initial migration

php artisan migrate


Step 05: Running artisan command for comment seeder only

php artisan db:seed --class=CommentSeeder


This will seed 50000 rows of data in comments table. Now you can seed even more with same amount of data in comments table.

Happy Seeding.

Related Posts