Johhn
Johhn

Reputation: 1039

Display Laravel artisan command output (command called from another command)

I am writing a console command. This command also calls another command.

Basically say: php artisan command:one. So inside command one, I call php artisan command:two.

They both have interactions ($this->info()) stating the progress or state of the current operations. But when I run php artisan command:one I can't see this displayed info from php artisan command:two, though php artisan command:two has its own output info and progress state.

How do I ensure to see the progress and states from php artisan command:two which is called in php artisan command:one?

Upvotes: 4

Views: 3588

Answers (1)

Styx
Styx

Reputation: 10076

Using Artisan::call() doesn't redirect called command's output to original command's output.

To call another Artisan command and save its output you should use $this->call() from your command.

Upvotes: 10

Related Questions