Skip to content

Commit

Permalink
#405 - update to Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofrewak committed Mar 20, 2024
1 parent 5f4694a commit 75b86ab
Show file tree
Hide file tree
Showing 14 changed files with 654 additions and 811 deletions.
2 changes: 1 addition & 1 deletion app/Domain/DailySummaryRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function getUpcomingBirthdays(?int $limit = null): Collection
$users = User::query()
->whereRelation("profile", fn(Builder $query): Builder => $query->whereNotNull("birthday"))
->get()
->sortBy(fn(User $user): int => $user->upcomingBirthday()->diffInDays(Carbon::today()));
->sortBy(fn(User $user): int => (int)$user->upcomingBirthday()->diffInDays(Carbon::today()));

if ($limit) {
return $users->take($limit);
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/EmployeesMilestonesRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getUpcomingBirthdays(?string $searchText, string $direction = "a
->search($searchText)
->get();

return $users->sortBy(fn(User $user): int => $user->upcomingBirthday()->diffInDays(Carbon::today()), descending: $direction !== "asc");
return $users->sortBy(fn(User $user): int => (int) $user->upcomingBirthday()->diffInDays(Carbon::today()), descending: $direction !== "asc");
}

public function getSeniority(?string $searchText, string $direction = "asc"): Collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function buildMailMessage(Notifiable $notifiable, string $url): MailMe
$message->line(__(":user - :date (in :difference days)", [
"user" => $user->profile->full_name,
"date" => $user->profile->next_medical_exam_date->toDisplayString(),
"difference" => $user->profile->next_medical_exam_date->diffInDays(Carbon::today()),
"difference" => (int)$user->profile->next_medical_exam_date->diffInDays(Carbon::today()),
]));
}
}
Expand All @@ -77,7 +77,7 @@ protected function buildMailMessage(Notifiable $notifiable, string $url): MailMe
$message->line(__(":user - :date (overdue :difference days)", [
"user" => $user->profile->full_name,
"date" => $user->profile->next_medical_exam_date->toDisplayString(),
"difference" => $user->profile->next_medical_exam_date->diffInDays(Carbon::today()),
"difference" => (int)$user->profile->next_medical_exam_date->diffInDays(Carbon::today()),
]));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function buildMailMessage(Notifiable $notifiable, string $url): MailMe
$message->line(__(":user - :date (in :difference days)", [
"user" => $user->profile->full_name,
"date" => $user->profile->next_ohs_training_date->toDisplayString(),
"difference" => $user->profile->next_ohs_training_date->diffInDays(Carbon::today()),
"difference" => (int)$user->profile->next_ohs_training_date->diffInDays(Carbon::today()),
]));
}
}
Expand All @@ -77,7 +77,7 @@ protected function buildMailMessage(Notifiable $notifiable, string $url): MailMe
$message->line(__(":user - :date (overdue :difference days)", [
"user" => $user->profile->full_name,
"date" => $user->profile->next_ohs_training_date->toDisplayString(),
"difference" => $user->profile->next_ohs_training_date->diffInDays(Carbon::today()),
"difference" => (int)$user->profile->next_ohs_training_date->diffInDays(Carbon::today()),
]));
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Eloquent/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function upcomingBirthday(): ?Carbon

$birthday = $this->profile->birthday->setYear($today->year);

if ($birthday->diffInDays(absolute: false) > 0) {
if (((int)$birthday->diffInDays(absolute: false)) > 0) {
$birthday->setYear($today->year + 1);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Infrastructure/Http/Resources/HolidayResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function toArray($request): array
"isSaturday" => $this->date->endOfDay()->isSaturday(),
"displayDate" => $this->date->toDisplayString(),
"dayOfWeek" => $this->date->dayName,
"daysToHoliday" => $this->date->diffInDays(),
"daysToHoliday" => (int)$this->date->diffInDays(),
"displayDaysToHoliday" => $this->date->diffForHumans(),
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function prepareRanges(Collection $days): array
];

foreach ($days as $day) {
if ($day->diffInDays($ranges[$index]["to"]) > 1) {
if (((int)$day->diffInDays($ranges[$index]["to"])) > 1) {
$index++;

$ranges[$index] = [
Expand Down
59 changes: 34 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,46 @@
"description": "HR software you love to hate",
"keywords": ["toby", "laravel", "hr"],
"license": "MIT",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/laravel-shift/laravel-ui-avatars.git"
},
{
"type": "vcs",
"url": "https://github.com/laravel-shift/laravel-slack-slash-command.git"
}
],
"require": {
"php": "^8.3",
"ext-pdo": "*",
"ext-redis": "*",
"azuyalabs/yasumi": "^2.6.0",
"barryvdh/laravel-dompdf": "^2.0.1",
"doctrine/dbal": "^3.7.2",
"fakerphp/faker": "^1.22.0",
"guzzlehttp/guzzle": "^7.7.0",
"inertiajs/inertia-laravel": "^0.6.11",
"laravel/framework": "^10.33.0",
"laravel/sanctum": "^3.3.2",
"laravel/socialite": "^5.10.0",
"laravel/telescope": "^4.17.2",
"laravel/tinker": "^2.8.1",
"maatwebsite/excel": "^3.1.50",
"phpoffice/phpword": "1.1.0",
"rackbeat/laravel-ui-avatars": "^1.2",
"sentry/sentry-laravel": "^4.1.0",
"spatie/laravel-google-calendar": "^3.7.1",
"spatie/laravel-model-states": "^2.4.6",
"spatie/laravel-permission": "^6.4.0",
"spatie/laravel-slack-slash-command": "^1.11.4"
"azuyalabs/yasumi": "^2.7",
"barryvdh/laravel-dompdf": "^2.0",
"fakerphp/faker": "^1.23",
"guzzlehttp/guzzle": "^7.8",
"inertiajs/inertia-laravel": "^1.0",
"laravel/framework": "^11.0",
"laravel/sanctum": "^4.0",
"laravel/socialite": "^5.12",
"laravel/telescope": "^5.0",
"laravel/tinker": "^2.9",
"maatwebsite/excel": "^3.1",
"phpoffice/phpword": "1.1",
"rackbeat/laravel-ui-avatars": "dev-l11-compatibility",
"sentry/sentry-laravel": "^4.2",
"spatie/laravel-google-calendar": "3.8",
"spatie/laravel-model-states": "^2.6",
"spatie/laravel-permission": "^6.4",
"spatie/laravel-slack-slash-command-slash-command": "dev-l11-compatibility"
},
"require-dev": {
"blumilksoftware/codestyle": "^2.8.0",
"laravel/dusk": "^7.11.4",
"mockery/mockery": "^1.5.1",
"nunomaduro/collision": "^7.10.0",
"phpunit/phpunit": "^10.4.2",
"spatie/laravel-ignition": "^2.3.1"
"blumilksoftware/codestyle": "^2.8",
"laravel/dusk": "^8.0",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.5",
"spatie/laravel-ignition": "^2.4"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 75b86ab

Please sign in to comment.