user()->load(['profile']); } public function show(int|string $id): void { $profile = $this->user->profile; $this->form->fill($this->user->only(['name', 'email'])); if ($profile) { $this->form->fill($profile->only(['gender', 'phone_number'])); $this->form->date_of_birth = $profile->date_of_birth?->format('Y-m-d'); } $this->id = $this->user->id; } public function save(UpdateProfile $updateProfile, UpdateUserIdentity $updateUser): void { $this->form->validate($this->form->rules($this->id)); $updateUser->execute($this->user, new UpdateUserIdentityDTO( name: $this->form->name, email: $this->form->email, )); $updateProfile->execute(new UpdateProfileDTO( userId: $this->id, gender: $this->form->gender, dateOfBirth: $this->form->date_of_birth, phoneNumber: $this->form->phone_number, )); $this->success($this->message); $this->dispatch('hide-update-profile-modal'); $this->dispatch('profile-updated'); } public function hide(): void { $this->form->reset(); $this->reset('id'); } };