*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'email' => $this->email, 'cpf' => $this->cpf, 'registration' => $this->registration, 'language' => $this->language, 'type' => $this->type, 'status' => $this->status, 'admission_date' => $this->admission_date?->format('d/m/Y'), 'expiry_date' => $this->expiry_date?->format('d/m/Y'), 'position_id' => $this->position_id, 'position' => $this->whenLoaded('position', fn() => ['id' => $this->position->id, 'name' => $this->position->name]), 'sector_id' => $this->sector_id, 'sector' => $this->whenLoaded('sector', fn() => ['id' => $this->sector->id, 'name' => $this->sector->name]), 'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'), 'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'), ]; } public static function collection($resource): AnonymousResourceCollection { return parent::collection($resource); } }