@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $rules['trans.' . $locale . '.label'] = 'required'; |
|
| 53 | - if ($this->request->get('trans.' . $locale . '.url') != null) { |
|
| 54 | - $rules['trans.' . $locale . '.url'] = 'url'; |
|
| 52 | + $rules['trans.'.$locale.'.label'] = 'required'; |
|
| 53 | + if ($this->request->get('trans.'.$locale.'.url') != null) { |
|
| 54 | + $rules['trans.'.$locale.'.url'] = 'url'; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | $attributes = []; |
| 64 | 64 | |
| 65 | 65 | foreach (array_keys($this->request->all('trans')) as $locale) { |
| 66 | - $attributes['trans.' . $locale . '.label'] = $locale . ' label'; |
|
| 67 | - $attributes['trans.' . $locale . '.url'] = $locale . ' link'; |
|
| 66 | + $attributes['trans.'.$locale.'.label'] = $locale.' label'; |
|
| 67 | + $attributes['trans.'.$locale.'.url'] = $locale.' link'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $attributes['owner_reference'] = 'Interne pagina'; |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | // Check if it is a relative |
| 97 | 97 | if ($this->isRelativeUrl($trans['url'])) { |
| 98 | - $data['trans'][$locale]['url'] = '/' . trim($trans['url'], '/'); |
|
| 98 | + $data['trans'][$locale]['url'] = '/'.trim($trans['url'], '/'); |
|
| 99 | 99 | } elseif (Str::startsWith($trans['url'], ['mailto:', 'tel:', 'https://', 'http://'])) { |
| 100 | 100 | $data['trans'][$locale]['url'] = $trans['url']; |
| 101 | - } else { |
|
| 101 | + }else { |
|
| 102 | 102 | $data['trans'][$locale]['url'] = Url::fromString($trans['url'])->secure()->get(); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -115,6 +115,6 @@ discard block |
||
| 115 | 115 | // Check if passed url is not intended as a host instead of a relative path |
| 116 | 116 | $notIntentedAsRoot = (null == Root::fromString($url)->getScheme() && false === strpos($url, '.')); |
| 117 | 117 | |
| 118 | - return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/' . $nakedUrl])); |
|
| 118 | + return ($notIntentedAsRoot && in_array($url, [$nakedUrl, '/'.$nakedUrl])); |
|
| 119 | 119 | } |
| 120 | 120 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function handle(): void |
| 25 | 25 | { |
| 26 | 26 | // CSV should consist of: locale - redirect url - target -url |
| 27 | - $this->loop($this->argument('file'), function ($row) { |
|
| 27 | + $this->loop($this->argument('file'), function($row) { |
|
| 28 | 28 | try { |
| 29 | 29 | $this->addRedirect->handle($row[0], $row[1], $row[2]); |
| 30 | 30 | } catch (UrlRecordNotFound $e) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | - $this->info('Added '.$row[0].' redirect: ' . $row[1] . ' -> ' . $row[2]); |
|
| 39 | + $this->info('Added '.$row[0].' redirect: '.$row[1].' -> '.$row[2]); |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | $this->info('Finished adding redirects'); |