This commit is contained in:
Adrian Hopek
2022-01-18 07:39:03 +01:00
parent 7dca5d1e6c
commit acf2eba95d
17 changed files with 644 additions and 32 deletions

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Toby\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserFormDataResource extends JsonResource
{
public static $wrap = false;
public function toArray($request): array
{
return [
"id" => $this->id,
"name" => $this->name,
"email" => $this->email,
"employmentForm" => $this->employment_form,
"employmentDate" => $this->employment_date,
];
}
}

View File

@@ -16,8 +16,9 @@ class UserResource extends JsonResource
"email" => $this->email,
"role" => "Human Resources Manager",
"avatar" => asset($this->avatar),
"trashed" => $this->trashed(),
"employmentForm" => $this->employment_form->label(),
"employmentStartDate" => $this->employment_start_date->translatedFormat("j F Y"),
"employmentDate" => $this->employment_date->translatedFormat("j F Y"),
];
}
}