generated from liutk/owl-admin-base
34 lines
1017 B
PHP
34 lines
1017 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class EmployeeResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'store_id' => $this->store_id,
|
|
'name' => $this->name,
|
|
'avatar' => $this->avatar,
|
|
'phone' => $this->phone,
|
|
'prize_images' => $this->prize_images,
|
|
'skill_images' => $this->skill_images,
|
|
'employee_status' => $this->employee_status,
|
|
'admin_user_id' => $this->admin_user_id,
|
|
'leave_at' => $this->leave_at?->timestamp,
|
|
'join_at' => $this->join_at?->timestamp,
|
|
'jobs' => KeywordResource::collection($this->whenLoaded('jobs')),
|
|
'store' => StoreResource::make($this->whenLoaded('store')),
|
|
];
|
|
}
|
|
}
|