* #28 - holidays management * #28 - fix * #28 - fix * #28 - fix * #28 - fix * #28 - fix * #28 - fix * #28 - cr fix
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user