Manage a business calendar with a working week, openings and events.
THIS IS NOT A STABLE PACKAGE AND SHOULD NOT BE USED IN PRODUCTION
In progress
$workingWeek->addOpening(new Opening([
'day' => Carbon::MONDAY, 'time' => '06:00', 'length' => 12 * 3600
]));
$workingWeek->addOpening($opening2);
$workingWeek->countOpenings(); // returns the count of the openings
$workingWeek->isOpenAt(Carbon::now()); // returns bool
$workingWeek->workingHours(); // returns the sum of the working hours of the openings
$opening->opensAt(); // Return a Carbon instance
$opening->closesAt(); // Return a Carbon instance
// Check wether the two Openings overlaps:
$opening1->overlaps($opening2); // returns bool
// Merge them:
$opening1->merge($opening2);
// Get the day value to instantiate an opening
Opening::dayOfWeek('monday') // returns 1
In progress
In progress
A couple of helpers to work with time and dates.
BusinessTime::dayFromString('Friday'); // returns 5
BusinessTime::dayToString(0); // returns 'Sunday'
BusinessTime::hoursToSeconds(2); // returns 7200
BusinessTime::secondsToHours(3600) // returns 1