#90 - cr fixes
This commit is contained in:
parent
4059b101f5
commit
1129f1ebc6
@ -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(),
|
||||
])
|
||||
|
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -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!", [
|
||||
|
@ -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.", [
|
||||
|
@ -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
|
||||
|
@ -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}";
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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(),
|
||||
];
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
];
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -17,7 +17,7 @@
|
||||
</InertiaLink>
|
||||
<span
|
||||
v-else
|
||||
class="flex justify-center items-center p-2 text-gray-400 bg-gray-100 rounded-l-md border border-r-0 border-gray-300 cursor-not-allowed md:px-2 md:w-9"
|
||||
class="flex justify-center items-center p-2 text-gray-400 bg-gray-100 rounded-l-md border border-r-0 border-gray-300 md:px-2 md:w-9"
|
||||
>
|
||||
<ChevronLeftIcon class="w-5 h-5" />
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user