<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aa-engineering / laravel-workday-manager example snippets
use AAEngineering\WorkdayManager\Models\MovedWorkday;
use Carbon\Carbon;
// A Saturday that becomes a working day
MovedWorkday::create([
'day' => '2025-12-14',
'type' => 'workday',
]);
// A Monday that becomes a holiday
MovedWorkday::create([
'day' => '2025-12-24',
'type' => 'holiday',
]);
use AAEngineering\WorkdayManager\WorkdayManager;
use Carbon\Carbon;
$date = Carbon::parse('2025-12-14');
// Check if a date has been changed to a holiday
if (WorkdayManager::isChangedToHoliday($date)) {
// This working day is now a holiday
}
// Check if a date has been changed to a workday
if (WorkdayManager::isChangedToWorkday($date)) {
// This weekend/holiday is now a working day
}
// Get the modification type (null, 'holiday', or 'workday')
$type = WorkdayManager::getModificationType($date);
use AAEngineering\WorkdayManager\Models\MovedWorkday;
// Create a random moved workday
$movedWorkday = MovedWorkday::factory()->create();
// Create a weekend moved to workday
$workday = MovedWorkday::factory()->workday()->create();
// Create a workday moved to holiday
$holiday = MovedWorkday::factory()->holiday()->create();