diff --git a/app/Architecture/ExceptionHandler.php b/app/Architecture/ExceptionHandler.php index 34869a2..b286bd1 100644 --- a/app/Architecture/ExceptionHandler.php +++ b/app/Architecture/ExceptionHandler.php @@ -17,6 +17,16 @@ class ExceptionHandler extends Handler "password_confirmation", ]; + protected array $handleByInertia = [ + Response::HTTP_INTERNAL_SERVER_ERROR, + Response::HTTP_SERVICE_UNAVAILABLE, + Response::HTTP_TOO_MANY_REQUESTS, + 419, // CSRF + Response::HTTP_NOT_FOUND, + Response::HTTP_FORBIDDEN, + Response::HTTP_UNAUTHORIZED, + ]; + public function render($request, Throwable $e): Response { $response = parent::render($request, $e); @@ -25,11 +35,11 @@ class ExceptionHandler extends Handler return $response; } - if ($response->status() === 405) { - $response->setStatusCode(404); + if ($response->status() === Response::HTTP_METHOD_NOT_ALLOWED) { + $response->setStatusCode(Response::HTTP_NOT_FOUND); } - if (in_array($response->status(), [500, 503, 429, 419, 404, 403, 401], true)) { + if (in_array($response->status(), $this->handleByInertia, true)) { return Inertia::render("Error", [ "status" => $response->status(), ]) diff --git a/app/Domain/Notifications/VacationRequestCreatedNotification.php b/app/Domain/Notifications/VacationRequestCreatedNotification.php index a9a54c3..d84d108 100644 --- a/app/Domain/Notifications/VacationRequestCreatedNotification.php +++ b/app/Domain/Notifications/VacationRequestCreatedNotification.php @@ -92,7 +92,7 @@ class VacationRequestCreatedNotification extends Notification return __("The vacation request :title has been created correctly by user :creator on your behalf in the :appName.", [ "title" => $this->vacationRequest->name, "appName" => $appName, - "creator" => $this->vacationRequest->creator->profile->fullName, + "creator" => $this->vacationRequest->creator->profile->full_name, ]); } } diff --git a/app/Domain/Notifications/VacationRequestStatusChangedNotification.php b/app/Domain/Notifications/VacationRequestStatusChangedNotification.php index 1f0329e..afbe01e 100644 --- a/app/Domain/Notifications/VacationRequestStatusChangedNotification.php +++ b/app/Domain/Notifications/VacationRequestStatusChangedNotification.php @@ -49,7 +49,7 @@ class VacationRequestStatusChangedNotification extends Notification $from = $this->vacationRequest->from->toDisplayString(); $to = $this->vacationRequest->to->toDisplayString(); $days = $this->vacationRequest->vacations()->count(); - $requester = $this->vacationRequest->user->profile->fullName; + $requester = $this->vacationRequest->user->profile->full_name; return (new MailMessage()) ->greeting(__("Hi :user!", [ diff --git a/app/Domain/Notifications/VacationRequestWaitsForApprovalNotification.php b/app/Domain/Notifications/VacationRequestWaitsForApprovalNotification.php index 847fd19..109eef9 100644 --- a/app/Domain/Notifications/VacationRequestWaitsForApprovalNotification.php +++ b/app/Domain/Notifications/VacationRequestWaitsForApprovalNotification.php @@ -84,7 +84,7 @@ class VacationRequestWaitsForApprovalNotification extends Notification protected function buildDescription(): string { $title = $this->vacationRequest->name; - $requester = $this->vacationRequest->user->profile->fullName; + $requester = $this->vacationRequest->user->profile->full_name; if ($this->vacationRequest->state->equals(WaitingForTechnical::class)) { return __("The vacation request :title from user :requester is waiting for your technical approval.", [ diff --git a/app/Domain/TimesheetPerUserSheet.php b/app/Domain/TimesheetPerUserSheet.php index 87d2c75..8547a5e 100644 --- a/app/Domain/TimesheetPerUserSheet.php +++ b/app/Domain/TimesheetPerUserSheet.php @@ -46,7 +46,7 @@ class TimesheetPerUserSheet implements WithTitle, WithHeadings, WithEvents, With public function title(): string { - return $this->user->profile->fullName; + return $this->user->profile->full_name; } public function headings(): array diff --git a/app/Eloquent/Models/Profile.php b/app/Eloquent/Models/Profile.php index cc28a59..df237e9 100644 --- a/app/Eloquent/Models/Profile.php +++ b/app/Eloquent/Models/Profile.php @@ -42,11 +42,11 @@ class Profile extends Model public function getAvatar(): string { return $this->getAvatarGenerator() - ->backgroundColor(ColorGenerator::generate($this->fullName)) + ->backgroundColor(ColorGenerator::generate($this->full_name)) ->image(); } - public function getFullNameAttribute(): string + public function getfullNameAttribute(): string { return "{$this->first_name} {$this->last_name}"; } diff --git a/app/Infrastructure/Console/Commands/MoveUserDataToProfile.php b/app/Infrastructure/Console/Commands/MoveUserDataToProfile.php index 7272268..565d244 100644 --- a/app/Infrastructure/Console/Commands/MoveUserDataToProfile.php +++ b/app/Infrastructure/Console/Commands/MoveUserDataToProfile.php @@ -16,7 +16,6 @@ class MoveUserDataToProfile extends Command { $users = User::all(); - /** @var User $user */ foreach ($users as $user) { $user->profile()->updateOrCreate(["user_id" => $user->id], [ "first_name" => $user->first_name, diff --git a/app/Infrastructure/Http/Resources/SimpleUserResource.php b/app/Infrastructure/Http/Resources/SimpleUserResource.php index 5807587..00a34fb 100644 --- a/app/Infrastructure/Http/Resources/SimpleUserResource.php +++ b/app/Infrastructure/Http/Resources/SimpleUserResource.php @@ -14,7 +14,7 @@ class SimpleUserResource extends JsonResource { return [ "id" => $this->id, - "name" => $this->profile->fullName, + "name" => $this->profile->full_name, "email" => $this->email, "avatar" => $this->profile->getAvatar(), ]; diff --git a/app/Infrastructure/Http/Resources/UserResource.php b/app/Infrastructure/Http/Resources/UserResource.php index fbec442..142aafe 100644 --- a/app/Infrastructure/Http/Resources/UserResource.php +++ b/app/Infrastructure/Http/Resources/UserResource.php @@ -14,7 +14,7 @@ class UserResource extends JsonResource { return [ "id" => $this->id, - "name" => $this->profile->fullName, + "name" => $this->profile->full_name, "email" => $this->email, "role" => $this->role->label(), "position" => $this->profile->position, diff --git a/app/Infrastructure/Http/Resources/VacationRequestActivityResource.php b/app/Infrastructure/Http/Resources/VacationRequestActivityResource.php index e1ab117..491468c 100644 --- a/app/Infrastructure/Http/Resources/VacationRequestActivityResource.php +++ b/app/Infrastructure/Http/Resources/VacationRequestActivityResource.php @@ -15,7 +15,7 @@ class VacationRequestActivityResource extends JsonResource return [ "date" => $this->created_at->toDisplayString(), "time" => $this->created_at->format("H:i"), - "user" => $this->user ? $this->user->profile->fullName : __("System"), + "user" => $this->user ? $this->user->profile->full_name : __("System"), "state" => $this->to, ]; } diff --git a/app/Infrastructure/Jobs/SendVacationRequestDaysToGoogleCalendar.php b/app/Infrastructure/Jobs/SendVacationRequestDaysToGoogleCalendar.php index a1dbe12..9510f72 100644 --- a/app/Infrastructure/Jobs/SendVacationRequestDaysToGoogleCalendar.php +++ b/app/Infrastructure/Jobs/SendVacationRequestDaysToGoogleCalendar.php @@ -32,7 +32,7 @@ class SendVacationRequestDaysToGoogleCalendar implements ShouldQueue $ranges = $this->prepareRanges($days); foreach ($ranges as $range) { - $text = "{$this->vacationRequest->type->label()} - {$this->vacationRequest->user->profile->fullName} [{$this->vacationRequest->name}]"; + $text = "{$this->vacationRequest->type->label()} - {$this->vacationRequest->user->profile->full_name} [{$this->vacationRequest->name}]"; $event = Event::create([ "name" => $text, diff --git a/resources/js/Pages/Calendar.vue b/resources/js/Pages/Calendar.vue index 8c6a18e..b913c2c 100644 --- a/resources/js/Pages/Calendar.vue +++ b/resources/js/Pages/Calendar.vue @@ -17,7 +17,7 @@