Completed
Pull Request — master (#30)
by Sebastian
04:14
created

UpdatesTranslations::updateTranslations()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 14
rs 9.2
cc 4
eloc 7
nc 4
nop 0
1
<?php
2
3
namespace App\Foundation\Models\Updaters;
4
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);
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ';', expecting ',' or ')'
Loading history...
18
            }
19
        }
20
    }
21
}
22