4

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?

4
  • How exactly do you call command:two? Show the code, please. Commented Jul 7, 2019 at 7:42
  • You may want to refer to exactly the documentation on this matter: laravel.com/docs/5.8/… Commented Jul 7, 2019 at 7:57
  • @Styx Artisan::call('command:two') Commented Jul 7, 2019 at 9:02
  • @D.Petrov trying that: seems promising though: thanks Commented Jul 7, 2019 at 9:03

1 Answer 1

10

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.

Sign up to request clarification or add additional context in comments.

1 Comment

could you share how we can save $this->call()'s output?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.