@@ -20,9 +20,9 @@ |
||
20 | 20 | |
21 | 21 | public function renderMetaTags(): string |
22 | 22 | { |
23 | - return $this->seo()->filter(function ($value, $key) { |
|
23 | + return $this->seo()->filter(function($value, $key) { |
|
24 | 24 | return starts_with($key, 'meta_'); |
25 | - })->map(function ($value, $key): string { |
|
25 | + })->map(function($value, $key): string { |
|
26 | 26 | $key = substr($key, 5); |
27 | 27 | $attribute = starts_with($key, 'og:') ? 'property' : 'name'; |
28 | 28 | return "<meta {$attribute}=\"{$key}\" content=\"{$value}\">"; |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | protected function updateSeoValues() |
12 | 12 | { |
13 | 13 | collect($this->request->all()) |
14 | - ->filter(function ($value, $fieldName) { |
|
14 | + ->filter(function($value, $fieldName) { |
|
15 | 15 | // Filter out everything that starts with 'translated_<locale>_seo_' |
16 | 16 | return Regex::match('/^translated_([a-z][a-z])_seo_/', $fieldName)->hasMatch(); |
17 | 17 | }) |
18 | - ->map(function ($value, $fieldName) { |
|
18 | + ->map(function($value, $fieldName) { |
|
19 | 19 | |
20 | 20 | // Replace 'translated_<locale>_seo_<attribute>' with '<locale>_<attribute>' |
21 | - $localeAndAttribute = Regex::replace('/translated_([a-z][a-z])_seo_/', function (MatchResult $matchResult) { |
|
22 | - return $matchResult->group(1) . '_'; |
|
21 | + $localeAndAttribute = Regex::replace('/translated_([a-z][a-z])_seo_/', function(MatchResult $matchResult) { |
|
22 | + return $matchResult->group(1).'_'; |
|
23 | 23 | }, $fieldName)->result(); |
24 | 24 | |
25 | 25 | $localeAndAttribute = explode('_', $localeAndAttribute, 2); |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | ]; |
32 | 32 | }) |
33 | 33 | ->groupBy('locale') |
34 | - ->map(function (Collection $valuesInLocale) { |
|
35 | - return $valuesInLocale->mapToAssoc(function ($values) { |
|
34 | + ->map(function(Collection $valuesInLocale) { |
|
35 | + return $valuesInLocale->mapToAssoc(function($values) { |
|
36 | 36 | return [$values['attribute'], $values['value']]; |
37 | 37 | }); |
38 | 38 | }) |
39 | - ->each(function ($values, $locale) { |
|
39 | + ->each(function($values, $locale) { |
|
40 | 40 | $this->model->setTranslation('seo_values', $locale, $values); |
41 | 41 | }); |
42 | 42 | } |
@@ -49,8 +49,7 @@ |
||
49 | 49 | 'meta_og:type' => 'website', |
50 | 50 | 'meta_og:description' => (string) string($this->text)->tease(155), |
51 | 51 | 'meta_og:image' => $this->hasMedia('images') ? |
52 | - url($this->getFirstMediaUrl('images')) : |
|
53 | - url('/images/og-image.png'), |
|
52 | + url($this->getFirstMediaUrl('images')) : url('/images/og-image.png'), |
|
54 | 53 | ]; |
55 | 54 | } |
56 | 55 | } |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | |
242 | 242 | public function seo(): string |
243 | 243 | { |
244 | - return locales()->map(function ($locale) { |
|
244 | + return locales()->map(function($locale) { |
|
245 | 245 | |
246 | 246 | return collect($this->model->defaultSeoValues()) |
247 | 247 | ->keys() |
248 | - ->map(function ($attribute) use ($locale) { |
|
248 | + ->map(function($attribute) use ($locale) { |
|
249 | 249 | |
250 | 250 | $fieldName = translate_field_name("seo.{$attribute}", $locale); |
251 | 251 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | ), |
258 | 258 | ]); |
259 | 259 | }) |
260 | - ->pipe(function (Collection $fields) use ($locale) { |
|
260 | + ->pipe(function(Collection $fields) use ($locale) { |
|
261 | 261 | return $this->languageFieldSet($locale, $fields->toArray()); |
262 | 262 | }); |
263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | protected function getSeoLabel(string $attribute): string |
268 | 268 | { |
269 | 269 | if (starts_with($attribute, 'meta_')) { |
270 | - return "Meta: " . substr($attribute, 5); |
|
270 | + return "Meta: ".substr($attribute, 5); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return fragment("back.seo.{$attribute}"); |