artarts36/laravel-holiday

Your Package Description here

1.0.4 2021-04-28 21:50 UTC

This package is auto-updated.

Last update: 2024-11-29 06:22:28 UTC


README

With this package you can save dates of holidays or shortened days on your Laravel application.

Testing License: MIT Total Downloads

Install

Run command: composer require artarts36/laravel-holiday

Add Provider: ArtARTs36\LaravelHoliday\Providers\HolidayProvider

Run command: php artisan migrate

Run command: php artisan db:seed --class=HolidayDatabaseSeeder

Commands

Examples

Determine work type by Day
$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determine(\Carbon\Carbon::parse('2020-11-04'))); // string(7) "weekend"
Determine work type by Period
$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determinePeriod(\Carbon\Carbon::parse('2020-11-04'), \Carbon\Carbon::parse('2020-12-15')));
Determine work type by Year
$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://isdayoff.ru/',
]);

$isDayOff = new \ArtARTs36\LaravelHoliday\Determiners\IsDayOff($client);

var_dump($isDayOff->determineYear(20));
Save Holidays for a concrete year
$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch('2019');
Save Holidays for a current year
$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_CURRENT_YEAR);
Save Holidays for a current month
$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_CURRENT_MONTH);
Save Holidays for a next week
$fetch = app(\ArtARTs36\LaravelHoliday\Services\Fetch::class);

$fetch->fetch(\ArtARTs36\LaravelHoliday\Services\Fetch::TYPE_NEXT_WEEK);