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

by darrion.kuhn , in category: PHP Frameworks , a year ago

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

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by larissa , a year 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.

Related Threads:

How to customize the log output for a job in laravel?
How to run laravel artisan command on server?
How to clear cache in Laravel without artisan?
How to fix "php artisan migrate" error in laravel?
How to echo session variable in laravel?
How to echo array elements in laravel?