@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function byKey($key, $section = null) |
| 36 | 36 | { |
| 37 | - return $this->model->when($section, function ($query) use ($section) { |
|
| 37 | + return $this->model->when($section, function($query) use ($section) { |
|
| 38 | 38 | $query->where('section', $section); |
| 39 | 39 | })->where('key', $key)->exists() ? $this->model->where('key', $key)->with('translations')->first()->value : null; |
| 40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getFormFields($section = null) |
| 47 | 47 | { |
| 48 | - $settings = $this->model->when($section, function ($query) use ($section) { |
|
| 48 | + $settings = $this->model->when($section, function($query) use ($section) { |
|
| 49 | 49 | $query->where('section', $section); |
| 50 | 50 | })->with('translations', 'medias')->get(); |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | if (config('twill.media_library.translated_form_fields', false)) { |
| 54 | - $medias = $settings->reduce(function ($carry, $setting) { |
|
| 54 | + $medias = $settings->reduce(function($carry, $setting) { |
|
| 55 | 55 | foreach (getLocales() as $locale) { |
| 56 | 56 | if (!empty(parent::getFormFields($setting)['medias'][$locale]) && !empty(parent::getFormFields($setting)['medias'][$locale][$setting->key])) |
| 57 | 57 | { |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | return $carry; |
| 62 | 62 | }); |
| 63 | 63 | } else { |
| 64 | - $medias = $settings->mapWithKeys(function ($setting) { |
|
| 64 | + $medias = $settings->mapWithKeys(function($setting) { |
|
| 65 | 65 | return [$setting->key => parent::getFormFields($setting)['medias'][$setting->key] ?? null]; |
| 66 | 66 | })->filter()->toArray(); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - return $settings->mapWithKeys(function ($setting) { |
|
| 69 | + return $settings->mapWithKeys(function($setting) { |
|
| 70 | 70 | $settingValue = []; |
| 71 | 71 | |
| 72 | 72 | foreach ($setting->translations as $translation) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if (config('twill.media_library.translated_form_fields', false)) { |
| 119 | 119 | foreach (getLocales() as $locale) { |
| 120 | - $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function ($media) { |
|
| 120 | + $medias["{$role}[{$locale}]"] = Collection::make($settingsFields['medias'][$role][$locale])->map(function($media) { |
|
| 121 | 121 | return json_decode($media, true); |
| 122 | 122 | })->filter()->toArray(); |
| 123 | 123 | } |
| 124 | 124 | } else { |
| 125 | - $medias = [ |
|
| 126 | - $role => Collection::make($settingsFields['medias'][$role])->map(function ($media) { |
|
| 125 | + $medias = [ |
|
| 126 | + $role => Collection::make($settingsFields['medias'][$role])->map(function($media) { |
|
| 127 | 127 | return json_decode($media, true); |
| 128 | 128 | })->values()->filter()->toArray(), |
| 129 | 129 | ]; |