diff --git a/src/Agenda/Weekly.php b/src/Agenda/Weekly.php index 6192526..ae4c41b 100644 --- a/src/Agenda/Weekly.php +++ b/src/Agenda/Weekly.php @@ -24,7 +24,7 @@ public function addTimePeriod(string $start_time, string $end_time): Weekly public function addTimePeriods(...$periods): Weekly { - collect([$periods])->flatten()->each(function ($period) { + collect([$periods])->flatten(2)->each(function ($period) { $this->addTimePeriod($period[0], $period[1]); }); diff --git a/src/SLA.php b/src/SLA.php index 3a27e4c..c2427c5 100644 --- a/src/SLA.php +++ b/src/SLA.php @@ -42,7 +42,7 @@ public function __construct(SLASchedule|array $schedules) { CarbonPeriod::mixin(EnhancedPeriod::class); - collect([$schedules])->flatten()->each(function ($b) { + collect([$schedules])->flatten(2)->each(function ($b) { $this->addSchedule($b); })->whenEmpty(function () { $this->addSchedule(SLASchedule::create()); @@ -58,7 +58,7 @@ public function addBreach(SLABreach $breach): self public function addBreaches(...$breaches): self { - collect([$breaches])->flatten()->each(fn ($b) => $this->addBreach($b)); + collect([$breaches])->flatten(2)->each(fn ($b) => $this->addBreach($b)); return $this; } @@ -86,7 +86,7 @@ public function clearPausePeriods(): self public function addHolidays($dates): self { - collect([$dates])->flatten()->each(fn ($d) => $this->addHoliday($d)); + collect([$dates])->flatten(2)->each(fn ($d) => $this->addHoliday($d)); return $this; }