PHP code example of aa-engineering / laravel-workday-manager

1. Go to this page and download the library: Download aa-engineering/laravel-workday-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?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();
bash
php artisan vendor:publish --tag="workday-manager-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="workday-manager-config"