From 568f914f3c5b12d0439366a99446179cf06f9a9c Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Sat, 29 Jun 2024 11:41:01 +0300 Subject: [PATCH] use getRawState for all --- src/Resources/Pages/CreateRecord/Concerns/Translatable.php | 4 ++-- src/Resources/Pages/EditRecord/Concerns/Translatable.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Resources/Pages/CreateRecord/Concerns/Translatable.php b/src/Resources/Pages/CreateRecord/Concerns/Translatable.php index 65168ee..f9f800e 100644 --- a/src/Resources/Pages/CreateRecord/Concerns/Translatable.php +++ b/src/Resources/Pages/CreateRecord/Concerns/Translatable.php @@ -84,11 +84,11 @@ public function updatedActiveLocale(string $newActiveLocale): void $translatableAttributes = static::getResource()::getTranslatableAttributes(); - $this->otherLocaleData[$this->oldActiveLocale] = Arr::only($this->form->getState(), $translatableAttributes); + $this->otherLocaleData[$this->oldActiveLocale] = Arr::only($this->form->getRawState(), $translatableAttributes); try { $this->form->fill([ - ...Arr::except($this->form->getState(false), $translatableAttributes), + ...Arr::except($this->form->getRawState(), $translatableAttributes), ...$this->otherLocaleData[$this->activeLocale] ?? [], ]); diff --git a/src/Resources/Pages/EditRecord/Concerns/Translatable.php b/src/Resources/Pages/EditRecord/Concerns/Translatable.php index 55e8b2f..bd80d63 100644 --- a/src/Resources/Pages/EditRecord/Concerns/Translatable.php +++ b/src/Resources/Pages/EditRecord/Concerns/Translatable.php @@ -42,7 +42,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model ->all(); try { - $this->form->fill($this->form->getState(false)); + $this->form->fill($this->form->getRawState()); $this->form->validate(); } catch (ValidationException $exception) { if (! array_key_exists($locale, $existingLocales)) { @@ -82,14 +82,14 @@ public function updatedActiveLocale(): void $translatableAttributes = static::getResource()::getTranslatableAttributes(); $this->otherLocaleData[$this->oldActiveLocale] = Arr::only( - $this->form->getState(false), + $this->form->getRawState(), $translatableAttributes ); try { $this->form->fill([ ...Arr::except( - $this->form->getState(false), + $this->form->getRawState(), $translatableAttributes ), ...$this->otherLocaleData[$this->activeLocale] ?? [],