#28 - holidays management (#30)

* #28 - holidays management

* #28 - fix

* #28 - fix

* #28 - fix

* #28 - fix

* #28 - fix

* #28 - fix

* #28 - cr fix
This commit is contained in:
Adrian Hopek
2022-01-25 09:02:48 +01:00
committed by GitHub
parent 6854c7a9f8
commit 026bfe485f
30 changed files with 938 additions and 23 deletions

View File

@@ -7,6 +7,7 @@ namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Toby\Helpers\PolishHolidaysRetriever;
use Toby\Helpers\UserAvatarGenerator;
use Toby\Models\User;
use Toby\Models\VacationLimit;
@@ -54,6 +55,16 @@ class DatabaseSeeder extends Seeder
->create();
}
})
->afterCreating(function (YearPeriod $yearPeriod): void {
$polishHolidaysRetriever = new PolishHolidaysRetriever();
foreach ($polishHolidaysRetriever->getForYearPeriod($yearPeriod) as $holiday) {
$yearPeriod->holidays()->create([
"name" => $holiday["name"],
"date" => $holiday["date"],
]);
}
})
->create();
}