| 1 | <?php |
||
| 5 | trait UpdatesTranslations |
||
| 6 | { |
||
| 7 | protected function updateTranslations() |
||
| 8 | { |
||
| 9 | foreach (config('app.locales') as $locale) { |
||
| 10 | foreach ($this->model->translatedAttributes as $fieldName) { |
||
| 11 | $translatedFieldName = translate_field_name($fieldName, $locale); |
||
| 12 | |||
| 13 | if (!$this->request->has($translatedFieldName)) { |
||
| 14 | continue; |
||
| 15 | } |
||
| 16 | |||
| 17 | $this->model->setTranslation($fieldName, $locale, $this->request->get($translatedFieldName); |
||
|
|
|||
| 18 | } |
||
| 19 | } |
||
| 20 | } |
||
| 21 | } |
||
| 22 |