async icon indicating copy to clipboard operation
async copied to clipboard

how to get the $output from Task

Open handhikadj opened this issue 6 months ago • 0 comments

in Laravel, I created a Task but it seems I can't get the returned data from the run method inside a Task class. the $output returns false

class MyTask extends Task
{
   public function configure() {}
   
   public function run() {
     return 'a'; // just an example. I can't get this data on the then()'s $output
   }
}

$pool = Pool::create()->autoload(public_path('index.php'));

foreach ($items as $item) {
  $pool->add(new MyTask())
  ->then(function ($output) {
    echo $output;
  })
}

handhikadj avatar Aug 15 '24 03:08 handhikadj