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 @@ -778,6 +778,25 @@ public function empty_translated_attribute(): void
778778 self ::assertNull ($ vegetable ->name );
779779 }
780780
781+ #[Test]
782+ public function empty_translations_are_not_saved (): void
783+ {
784+ $ vegetable = new Vegetable ();
785+ $ vegetable ->fill ([
786+ 'en ' => [],
787+ 'de ' => ['name ' => 'Erbsen ' ],
788+ ]);
789+
790+ $ vegetable ->save ();
791+
792+ self ::assertDatabaseHas ('vegetable_translations ' , [
793+ 'locale ' => 'de ' ,
794+ 'name ' => 'Erbsen ' ,
795+ ]);
796+
797+ self ::assertDatabaseMissing ('vegetable_translations ' , ['locale ' => 'en ' ]);
798+ }
799+
781800 #[Test]
782801 public function numeric_translated_attribute (): void
783802 {
You can’t perform that action at this time.
0 commit comments