Laravel Console Task
Laravel Console Task is a package by Nuno Maduro that allows you to perform tasks and to output the results to the console. For example, lets say your package comes with a console command that checks for certain requirements to validate that the installation is compatible with your PHP environment: As seen in the above example, the macro returns the result of the closure, which means you can capture the result in a variable if you need to reference the outcome later in your console. If youre interested in the implementation behind this package, check out Nunos Laravel Console Task post on Medium. You can also check out the macro implementation here that makes $this->task() possible in Artisan console commands.
Read Full Article at https://laravel-news.com/laravel-console-task