laravel seed rollback after seeding database laravel seed rollback after seeding database laravel laravel

laravel seed rollback after seeding database


use Undo Seeder for Laravel.

When you install UndoSeeder, the following artisan commands are made available:

db:seed-undo    Undo seeds in the seeds directory.db:seed-refresh Undo seeds run seeds again.

more Undo-Seeder


You may also seed your database using the migrate:refresh command, which will also rollback and re-run all of your migrations. This command is useful for completely re-building your database:

php artisan migrate:refresh --seed

Running Seeders


If you want to wipe out certain table, then just TRUNCATE that table, and seed it again:

php artisan db:seed --class=UsersTableSeeder

No need for additional packages for such a simple task.