I\'m using Artisan::call()
in one of my routes and would like to save the command output to a variable.
Is there any way to capture the STDOUT and STDER
Seems the previous answers don't work in Laravel 5.2 any more (not sure about 5.1)
You can now use Artisan::output();
$output = '';
if (!Schema::hasTable('migrations')) {
Artisan::call('migrate:install', array());
$output .= Artisan::output();
}
// Updates the migration, then seed the database
Artisan::call('migrate:refresh', array('--force' => 1));
$output .= Artisan::output();
Artisan::call('db:seed', array('--force' => 1));
$output .= Artisan::output();
dd($output);