-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * wip * wip * wip * fix * fix * fix * cs fix
- Loading branch information
Showing
120 changed files
with
1,153 additions
and
1,989 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ google-credentials.json | |
.composer | ||
.deployment | ||
/.phpunit.cache | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Carbon; | ||
use Toby\Domain\PolishHolidaysRetriever; | ||
use Toby\Models\Holiday; | ||
|
||
class GenerateHolidays extends Command | ||
{ | ||
protected $signature = "toby:holidays:generate {year?}"; | ||
protected $description = "Generate default holidays for year"; | ||
|
||
public function handle(PolishHolidaysRetriever $polishHolidaysRetriever): void | ||
{ | ||
$year = (int)$this->argument("year") ?? Carbon::now()->year; | ||
|
||
$holidays = $polishHolidaysRetriever->getForYear($year); | ||
|
||
foreach ($holidays as $holiday) { | ||
Holiday::query() | ||
->updateOrCreate([ | ||
"name" => $holiday["name"], | ||
"date" => $holiday["date"], | ||
]); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/Console/Commands/MigrateYearPeriodYearToVacationLimits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class MigrateYearPeriodYearToVacationLimits extends Command | ||
{ | ||
protected $signature = "toby:migrate-year-period-year-to-vacation-limits"; | ||
protected $description = "Migrate year period to vacation limits"; | ||
|
||
public function handle(): void | ||
{ | ||
if (!Schema::hasTable("year_periods")) { | ||
$this->error("Year periods don't exist"); | ||
|
||
return; | ||
} | ||
|
||
DB::statement(" | ||
UPDATE vacation_limits | ||
SET year = year_periods.year | ||
FROM year_periods | ||
WHERE year_periods.id = vacation_limits.year_period_id | ||
"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.