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

UpdatesTranslations   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 17
rs 10
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