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(\'
When the Artisan command output you want is issuing an echo
.
You can access this type of output with ob_start and ob_get_clean.
For example, if your command echos JSON.
Artisan::command('myecho:command', function () {
echo json_encode(config('myconfig'), true);
})->describe('outputs json');
Then you can access the JSON output by wrapping the command call in a buffer:
\ob_start();
\Artisan::call('myecho:command');
$output = \ob_get_clean();
var_dump($output);