When running php artisan migrate --seed, I would like to intercept the moment between migration finish and seeding start.
It seems that attaching listeners on Artisan command events catches only "top level" command:
Event::listen(CommandStarting::class, function (CommandStarting $event) use ($path) {
echo "Start\n";
echo $event->input;
});
Event::listen(CommandFinished::class, function (CommandFinished $event) use ($path) {
echo "Finish\n";
echo $event->input;
});
This will output only migrate --seed command, independently of the fact that --seed flag actually calls the db:seed command:
if ($this->option('seed') && ! $this->option('pretend')) {
$this->call('db:seed', ['--force' => true]);
}
Is it possible to somehow catch that event in-between?