Skip to content
Hi, I'm Alex & I'm currently looking for a Laravel job. Please reach out to me via twitter, or click this link.

Pausing SLAs

Pausing generates periods of time we don't want to count towards our SLA Timer.

Pausing works retroactively to the status or duration method and is required to be defined before we calculate the full SLA.

SLA Pausing Diagram – Showing the periods of approx. 9am to 5pm covered each week day, but with a paused period on Wednesday
// Given the time now is 14:00:00 29-07-2022

$sla = SLA::fromSchedule(
    SLASchedule::create()->from('09:00:00')->to('17:30:00')
);

$sla->addPause('03:00:00 27-07-2022', '13:59:59 27-07-2022');

$sla->duration('05:35:40 25-07-2022')->totalHours; // 34

Note:

If you want to specify a full day of pausing, you might want to setup Holidays instead.

Released under the MIT License.