#4- wip
This commit is contained in:
23
app/Http/Resources/UserFormDataResource.php
Normal file
23
app/Http/Resources/UserFormDataResource.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
@@ -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"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user