1

I have multiple laravel-zero task like this, how to stop all task below if task A false condition?

$this->task("Task A", function () {
  if (!condition) {
   return false;
   exit;
   die;
  }
});

$this->task("Task B", function () {
  return true;
});

I want if condition in Task A false, abort all task below, i try exit, die, and $this->stop() but task in below keep running? any suggestion how i handle this?

1 Answers1

1

Finally I use this approach:

$taskA = $this->task("Task A", function () {
  if (!condition) {
   return false;
  }
});

if(!$taskA) {
  exit;
}

$this->task("Task B", function () {
  return true;
});