diff --git a/src/Objects/People/Attributes/PersonAttributes.php b/src/Objects/People/Attributes/PersonAttributes.php index f2a1653..76a4f91 100644 --- a/src/Objects/People/Attributes/PersonAttributes.php +++ b/src/Objects/People/Attributes/PersonAttributes.php @@ -11,35 +11,35 @@ class PersonAttributes { public string $personId; - public ?string $givenName; - public ?string $firstName; - public ?string $nickname; - public ?string $middleName; - public ?string $lastName; - public ?Carbon $birthdate; - public ?Carbon $anniversary; - public ?string $gender; - public ?int $grade; - public ?bool $child; - public ?int $graduationYear; - public ?bool $siteAdministrator; - public ?bool $accountingAdministrator; - public ?string $peoplePermissions; - public ?string $membership; - public ?Carbon $inactivatedAt; - public ?string $medicalNotes; - public ?bool $mfaConfigured; - public ?Carbon $createdAt; - public ?Carbon $updatedAt; - public ?string $avatar; - public ?string $name; - public ?string $demographicAvatarUrl; - public ?string $directoryStatus; - public ?bool $passedBackgroundCheck; - public ?bool $canCreateForms; - public ?bool $canEmailLists; - public ?string $schoolType; - public ?string $status; - public ?int $primaryCampusId; - public ?int $remoteId; + public ?string $givenName = null; + public ?string $firstName = null; + public ?string $nickname = null; + public ?string $middleName = null; + public ?string $lastName = null; + public ?Carbon $birthdate = null; + public ?Carbon $anniversary = null; + public ?string $gender = null; + public ?int $grade = null; + public ?bool $child = null; + public ?int $graduationYear = null; + public ?bool $siteAdministrator = null; + public ?bool $accountingAdministrator = null; + public ?string $peoplePermissions = null; + public ?string $membership = null; + public ?Carbon $inactivatedAt = null; + public ?string $medicalNotes = null; + public ?bool $mfaConfigured = null; + public ?Carbon $createdAt = null; + public ?Carbon $updatedAt = null; + public ?string $avatar = null; + public ?string $name = null; + public ?string $demographicAvatarUrl = null; + public ?string $directoryStatus = null; + public ?bool $passedBackgroundCheck = null; + public ?bool $canCreateForms = null; + public ?bool $canEmailLists = null; + public ?string $schoolType = null; + public ?string $status = null; + public ?int $primaryCampusId = null; + public ?int $remoteId = null; } diff --git a/src/Objects/People/Person.php b/src/Objects/People/Person.php index 6ba92ec..d74a5d7 100644 --- a/src/Objects/People/Person.php +++ b/src/Objects/People/Person.php @@ -148,8 +148,8 @@ private function mapToPco(): array "first_name" => $this->attributes->firstName ?? null, "middle_name" => $this->attributes->middleName ?? null, "last_name" => $this->attributes->lastName ?? null, - "birthdate" => $this->attributes->birthdate ?? null, - "anniversary" => $this->attributes->anniversary ?? null, + "birthdate" => $this->attributes->birthdate?->toDateString() ?? null, + "anniversary" => $this->attributes->anniversary?->toDateString() ?? null, "gender" => $this->attributes->gender ?? null, "grade" => $this->attributes->grade ?? null, "child" => $this->attributes->child ?? null, @@ -158,11 +158,11 @@ private function mapToPco(): array "accounting_administrator" => $this->attributes->accountingAdministrator ?? null, "people_permissions" => $this->attributes->peoplePermissions ?? null, "membership" => $this->attributes->membership ?? null, - "inactivated_at" => $this->attributes->inactivatedAt ?? null, + "inactivated_at" => $this->attributes->inactivatedAt?->toDateTimeString() ?? null, "medical_notes" => $this->attributes->medicalNotes ?? null, "mfa_configured" => $this->attributes->mfaConfigured ?? null, - "created_at" => $this->attributes->createdAt ?? null, - "updated_at" => $this->attributes->updatedAt ?? null, + "created_at" => $this->attributes->createdAt?->toDateTimeString() ?? null, + "updated_at" => $this->attributes->updatedAt?->toDateTimeString() ?? null, "avatar" => $this->attributes->avatar ?? null, "name" => $this->attributes->name ?? null, "demographic_avatar_url" => $this->attributes->demographicAvatarUrl ?? null, @@ -186,6 +186,8 @@ private function mapToPco(): array $person["data"]["attributes"]["demographic_avatar_url"] ); - return Arr::whereNotNull($person["data"]["attributes"]); + $person["data"]["attributes"] = Arr::whereNotNull($person["data"]["attributes"]); + + return $person; } }