File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ protected function isTranslationDirty(Model $translation): bool
347347 {
348348 $ dirtyAttributes = $ translation ->getDirty ();
349349 unset($ dirtyAttributes [$ this ->getLocaleKey ()]);
350+ unset($ dirtyAttributes [$ this ->getTranslationRelationKey ()]);
350351
351352 return count ($ dirtyAttributes ) > 0 ;
352353 }
Original file line number Diff line number Diff line change @@ -763,6 +763,25 @@ public function empty_translated_attribute(): void
763763 self ::assertNull ($ vegetable ->name );
764764 }
765765
766+ #[Test]
767+ public function empty_translations_are_not_saved (): void
768+ {
769+ $ vegetable = new Vegetable ();
770+ $ vegetable ->fill ([
771+ 'en ' => [],
772+ 'de ' => ['name ' => 'Erbsen ' ],
773+ ]);
774+
775+ $ vegetable ->save ();
776+
777+ self ::assertDatabaseHas ('vegetable_translations ' , [
778+ 'locale ' => 'de ' ,
779+ 'name ' => 'Erbsen ' ,
780+ ]);
781+
782+ self ::assertDatabaseMissing ('vegetable_translations ' , ['locale ' => 'en ' ]);
783+ }
784+
766785 #[Test]
767786 public function numeric_translated_attribute (): void
768787 {
You can’t perform that action at this time.
0 commit comments