$this->id, 'unit_id' => $this->unit_id, 'name' => $this->name, 'social_name' => $this->social_name, 'role' => $this->role, 'cpf' => $this->cpf, 'rg' => $this->rg, 'birth_date' => $this->birth_date?->format('Y-m-d'), 'participation' => $this->participation, 'email' => $this->email, 'secondary_email' => $this->secondary_email, 'phone_number' => $this->phone_number, 'cell_number' => $this->cell_number, 'postal_code' => $this->postal_code, 'street' => $this->street, 'address_number' => $this->address_number, 'neighborhood' => $this->neighborhood, 'complement' => $this->complement, 'city_id' => $this->city_id, 'state_id' => $this->state_id, 'avatar_url' => $this->avatar_url ? Storage::temporaryUrl($this->avatar_url, now()->addHours(24)) : null, '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'), 'city' => $this->whenLoaded('city', fn() => [ 'id' => $this->city->id, 'name' => $this->city->name, ]), 'state' => $this->whenLoaded('state', fn() => [ 'id' => $this->state->id, 'name' => $this->state->name, 'code' => $this->state->code, ]), ]; } /** * @param \Illuminate\Database\Eloquent\Collection $resource * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection */ public static function collection($resource): AnonymousResourceCollection { return parent::collection($resource); } }