Get response from Artisan call

后端 未结 7 1378
情深已故
情深已故 2021-02-18 22:56

When I run in terminal php artisan migrate this results in \'Nothing to migrate\' when indeed there is nothing to migrate.

When I use Artisan::call(\'

7条回答
  •  温柔的废话
    2021-02-18 23:02

    Yes, it's possible. To get the output of a built-in artisan command from inside a custom command, pass the OutputStream from your command into the Artisan::call. Example:

    class MyCommand extends \Illuminate\Console\Command
    {
        public function fire()
        {
            \Artisan::call('optimize', [], $this->getOutput());
        }
    }
    

提交回复
热议问题