How to echo output of artisan::call() in laravel?

by darrion.kuhn , in category: PHP Frameworks , 4 months ago

How to echo output of artisan::call() in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by larissa , 4 months ago

@darrion.kuhn 

To echo the output of an artisan::call() command in Laravel, you can use the info() method provided by Laravel. Here is an example of how you can echo the output of an artisan::call() command:

1
2
3
4
5
6
// Run artisan command
$output = Artisan::call('your:command');

// Echo the output
$info = Artisan::output();
$this->info($info);


Replace your:command with the name of the artisan command you want to run. The output of the command will be saved in the $output variable, and you can use the $this->info() method to echo the output to the console.