Skip to content

Commit

Permalink
Update Translatable.php
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Sep 13, 2024
1 parent 576779b commit b75d977
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Resources/Pages/CreateRecord/Concerns/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ public function updatedActiveLocale(string $newActiveLocale): void

$translatableAttributes = static::getResource()::getTranslatableAttributes();

$this->otherLocaleData[$this->oldActiveLocale] = Arr::only($this->form->getRawState(), $translatableAttributes);

try {
$this->otherLocaleData[$this->oldActiveLocale] = Arr::only(
$this->form->getRawState(),
$translatableAttributes
);

$this->form->fill([
...Arr::except($this->form->getRawState(), $translatableAttributes),
...Arr::except(
$this->form->getRawState(),
$translatableAttributes
),
...$this->otherLocaleData[$this->activeLocale] ?? [],
]);

Expand Down

0 comments on commit b75d977

Please sign in to comment.