#28 - holidays management

This commit is contained in:
Adrian Hopek
2022-01-24 14:03:39 +01:00
parent 6854c7a9f8
commit 29d81030ac
20 changed files with 792 additions and 9 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();
}