Skip to content

Commit

Permalink
Fix updating translations
Browse files Browse the repository at this point in the history
  • Loading branch information
acasar authored Sep 29, 2016
1 parent 1df9000 commit bab861f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ protected function updateI18n(array $values)
return true;
}

$updated = $this->i18nQuery()
$query = $this->i18nQuery()
->whereOriginal($this->model->getForeignKey(), $this->model->getKey())
->whereOriginal($this->model->getLocaleKey(), $this->model->getLocale())
->update($values);
->whereOriginal($this->model->getLocaleKey(), $this->model->getLocale());

if(!$updated) {
if($query->exists()) {
return $query->update($values);
} else {
return $this->insertI18n($values, $this->model->getKey());
}

return true;
}

/**
Expand Down Expand Up @@ -181,4 +180,4 @@ protected function i18nDeleteQuery($withGlobalScopes = true)

return $query;
}
}
}

0 comments on commit bab861f

Please sign in to comment.