You can use
php artisan migrate:refresh --seed
It combines
php artisan migrate:reset
php artisan migrate
php artisan db:seed
Make sure that your down functions in your migrations is correct since it resets the database.
This will remove all the data in all your tables so don't use this if the data isn't only created from your seeds.
I'm just starting a new web app and have encountered the same issue.
Would it be best practice to not use auto incrementing ID's on tables that contain base data for an application? As in chrisgeary92's issue above: if the roles/permissions table didn't use incrementing ID's then you could just re-seed that table with new data and your ID's would remain the same.
You could still use auto-increments on the table even if you specify the ID explicitly when you insert. For example:
DB::table('foo')->insert(
array('id' => 1, 'bar' => 'baz'),
array('id' => 3, 'bar' => $whateverFillerWordComesAfterBaz)
);
Now if you insert another row without specifying an ID, the autoincrement should set it to 4.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community