profileRelation(); $profile = $relation ? $this->{$relation} : null; return [ 'id' => $this->uuid, 'db_id' => $this->id, 'email' => $this->email, 'phone' => $this->phone, 'first_name' => $this->first_name, 'middle_name' => $this->middle_name, 'last_name' => $this->last_name, 'full_name' => $this->full_name, 'role' => $this->role, 'status' => $this->status, 'preferred_language' => $this->preferred_language, 'avatar_path' => $this->avatar_path, 'email_verified_at' => $this->email_verified_at?->toIso8601String(), 'phone_verified_at' => $this->phone_verified_at?->toIso8601String(), 'last_login_at' => $this->last_login_at?->toIso8601String(), 'created_at' => $this->created_at?->toIso8601String(), 'profile' => $profile?->toArray(), 'has_household' => $this->headedHousehold()->exists() || $this->householdMemberships()->exists(), 'tenant' => $this->whenLoaded('tenant', fn () => [ 'id' => $this->tenant->id, 'name' => $this->tenant->name, ]), ]; } }