Skip to content

Commit

Permalink
fix saving method
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Aug 26, 2021
1 parent 89358b9 commit 8674c1f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Translatable.php
Expand Up @@ -44,10 +44,16 @@ public static function bootTranslatable()
});

// STORE/UPDATE
static::saving(function (Model $model) {
foreach ($model->translatableAttributes as $attr)
if ($model->{$attr} ?? null) unset($model->{$attr});
});

// SAVED
static::saved(function (Model $model) {
$model->saveTranslations();
});

// DESTROY
static::deleting(function (Model $model) {
$model->deleteTranslations();
Expand Down

0 comments on commit 8674c1f

Please sign in to comment.