Skip to content

Commit

Permalink
fix retrieve method
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Aug 27, 2021
1 parent cc63ae1 commit 97a4dbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Translatable.php
Expand Up @@ -38,7 +38,7 @@ public static function bootTranslatable()
{
// GET
static::retrieved(function (Model $model) {
if (isset($model->translatableAttributes))
if (isset($model->translatableAttributes) && $model->relationLoaded('translations'))
foreach ($model->translatableAttributes as $attr)
$model->setAttribute($attr, $model->translateOrDefault()->{$attr} ?? null);
});
Expand Down

0 comments on commit 97a4dbf

Please sign in to comment.