I have tried the method described here but this doesn't work on my Laravel 5 installation.
use Symfony\Component\Console\Output\BufferedOutput;
Route::get('/test', function()
{
$output = new BufferedOutput;
Artisan::call('testCommand', array(), $output);
return $output->fetch();
});
My command;
public function fire()
{
$this->info('No output visible');
}
Any suggestions what I might do wrong? Or is it something that has changed in Laravel 5?
I managed to get this to work using Artisan::output()
, which returns the output of the latest command.
Route::get('/test', function()
{
Artisan::call('testCommand', array());
return Artisan::output();
});
should do it for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With