toby/app/Http/Resources/UserResource.php
Adrian Hopek 6854c7a9f8
#27 - separate fields for name and surname (#29)
* #27 - separate fields for name and surname

* #27 -cr fix
2022-01-24 12:40:56 +01:00

27 lines
662 B
PHP

<?php
declare(strict_types=1);
namespace Toby\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserResource extends JsonResource
{
public static $wrap = null;
public function toArray($request): array
{
return [
"id" => $this->id,
"name" => $this->fullName,
"email" => $this->email,
"role" => "Human Resources Manager",
"avatar" => asset($this->avatar),
"deleted" => $this->trashed(),
"employmentForm" => $this->employment_form->label(),
"employmentDate" => $this->employment_date->toDisplayString(),
];
}
}