When running php artisan migrate:fresh --seed --no-interact, the --no-interact option is not passed along when running the DatabaseSeeder, thus I end up being asked things from my interactive seeders instead of them using the defaults.
Running php artisan db:seed --no-interact works well. db:seed just runs DatabaseSeeder that again just has a bunch of $this->call('SeederName');s, but all of those seeder get the --no-interact option applied.
Wouldn't it make sense for this to be the case when running migrate:fresh --seed --no-interact as well?
I have tested this in Laravel 5.8.31 as well, and this does not happen there, so is has likely been fixed at some point, but not backported to 5.5?
Edit: this is also related to #27009 and #27012.
$this->command->ask() - and provide a default answer.database/seeds/DatabaseSeeder.phpphp artisan db:seed -n and see that it is seeded without the question appearing, defaulting to the correct valuephp artisan migrate:fresh --seed -n and see that the migrations are re-run successfully, but when starting to seed it will ask your quesiton, halting the process if it is scripted.php artisan migrate:fresh && php artisan db:seed -n
It seems this is the commit that fixed this in more recent versions: https://github.com/laravel/framework/commit/01374db3f8dfce9995370fa12a487ce10d7a4d7c
Workaround
php artisan migrate:fresh && php artisan db:seed -n
Thank you for this workaround :+1:
@carestad feel free to send in a PR to the 5.5 branch. Please be aware that support for 5.5 ends this month so make sure you upgrade soon.
@carestad feel free to send in a PR to the 5.5 branch. Please be aware that support for 5.5 ends this month so make sure you upgrade soon.
Done! #29478
Basically a cherry-picking of #27012.
Merged.
Most helpful comment
Merged.