@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
23 | 23 | $module->update([ |
24 | - 'slug' => $module->slug . $this->appendDeleteMarker(), |
|
24 | + 'slug' => $module->slug.$this->appendDeleteMarker(), |
|
25 | 25 | ]); |
26 | 26 | |
27 | 27 | $module->delete(); |
@@ -35,6 +35,6 @@ discard block |
||
35 | 35 | |
36 | 36 | private function appendDeleteMarker(): string |
37 | 37 | { |
38 | - return '_DELETED_' . time(); |
|
38 | + return '_DELETED_'.time(); |
|
39 | 39 | } |
40 | 40 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | private function saveRecord(string $locale, ?string $slug) |
58 | 58 | { |
59 | 59 | // Existing ones for this locale? |
60 | - $nonRedirectsWithSameLocale = $this->existingRecords->filter(function ($record) use ($locale) { |
|
60 | + $nonRedirectsWithSameLocale = $this->existingRecords->filter(function($record) use ($locale) { |
|
61 | 61 | return ( |
62 | 62 | $record->locale == $locale && |
63 | 63 | !$record->isRedirect() |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // If slug entry is left empty, all existing records will be deleted |
68 | 68 | if (!$slug) { |
69 | - $nonRedirectsWithSameLocale->each(function ($existingRecord) { |
|
69 | + $nonRedirectsWithSameLocale->each(function($existingRecord) { |
|
70 | 70 | $existingRecord->delete(); |
71 | 71 | }); |
72 | 72 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Only replace the existing records that differ from the current passed slugs |
85 | - $nonRedirectsWithSameLocale->each(function ($existingRecord) use ($slug) { |
|
85 | + $nonRedirectsWithSameLocale->each(function($existingRecord) use ($slug) { |
|
86 | 86 | if ($existingRecord->slug != $slug) { |
87 | 87 | $existingRecord->replaceAndRedirect(['slug' => $slug]); |
88 | 88 | } |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | */ |
128 | 128 | private function deleteIdenticalRedirects($existingRecords, $locale, $slug): void |
129 | 129 | { |
130 | - $existingRecords->filter(function ($record) use ($locale) { |
|
130 | + $existingRecords->filter(function($record) use ($locale) { |
|
131 | 131 | return ( |
132 | 132 | $record->locale == $locale && |
133 | 133 | $record->isRedirect() |
134 | 134 | ); |
135 | - })->each(function ($existingRecord) use ($slug) { |
|
135 | + })->each(function($existingRecord) use ($slug) { |
|
136 | 136 | if ($existingRecord->slug == $slug) { |
137 | 137 | $existingRecord->delete(); |
138 | 138 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | |
148 | 148 | // The old homepage url should be removed since this is no longer in effect. |
149 | 149 | // In case of any redirect to this old homepage, the last used redirect is now back in effect. |
150 | - $existingRecords->reject(function ($existingRecord) { |
|
150 | + $existingRecords->reject(function($existingRecord) { |
|
151 | 151 | return ( |
152 | 152 | $existingRecord->model_type == $this->model->getMorphClass() && |
153 | 153 | $existingRecord->model_id == $this->model->id); |
154 | - })->each(function ($existingRecord) { |
|
154 | + })->each(function($existingRecord) { |
|
155 | 155 | |
156 | 156 | // TODO: if there is a redirect to this page, we'll take this one as the new url |
157 | 157 | $existingRecord->delete(); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public static function prepend(ProvidesUrl $model, string $slug, $locale): string |
16 | 16 | { |
17 | - $slugWithBaseSegment = $model->baseUrlSegment($locale) . '/' . $slug; |
|
17 | + $slugWithBaseSegment = $model->baseUrlSegment($locale).'/'.$slug; |
|
18 | 18 | $slugWithBaseSegment = trim($slugWithBaseSegment, '/'); |
19 | 19 | |
20 | 20 | // If slug with base segment is empty string, it means that the passed slug was probably a "/" character. |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ->first(); |
37 | 37 | |
38 | 38 | if (!$record) { |
39 | - throw new UrlRecordNotFound('No url record found for model [' . $model->getMorphClass() . '@' . $model->id . '] for locale [' . $locale . '].'); |
|
39 | + throw new UrlRecordNotFound('No url record found for model ['.$model->getMorphClass().'@'.$model->id.'] for locale ['.$locale.'].'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $record; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public static function getByModel(Model $model) |
46 | 46 | { |
47 | - return chiefMemoize('url-records-get-by-model', function ($model) { |
|
47 | + return chiefMemoize('url-records-get-by-model', function($model) { |
|
48 | 48 | return parent::getByModel($model); |
49 | 49 | }, [$model]); |
50 | 50 | } |
@@ -60,6 +60,6 @@ |
||
60 | 60 | */ |
61 | 61 | public function message() |
62 | 62 | { |
63 | - return 'De \'' . $this->failedDetails['slug'] . '\' link wordt in het ' . $this->failedDetails['locale'] . ' al door een andere pagina gebruikt.'; |
|
63 | + return 'De \''.$this->failedDetails['slug'].'\' link wordt in het '.$this->failedDetails['locale'].' al door een andere pagina gebruikt.'; |
|
64 | 64 | } |
65 | 65 | } |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function get(): string |
36 | 36 | { |
37 | - $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : ''; |
|
37 | + $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : ''; |
|
38 | 38 | $guessedParentViewName = $this->parent ? $this->parent->viewKey() : ''; |
39 | 39 | $guessedViewName = $this->viewable->viewKey(); |
40 | 40 | |
41 | 41 | $viewPaths = [ |
42 | - $basePath . $guessedParentViewName . '.' . $guessedViewName, |
|
43 | - $basePath . $guessedViewName, |
|
44 | - $basePath . $guessedViewName . '.show', |
|
45 | - $basePath . 'show', |
|
42 | + $basePath.$guessedParentViewName.'.'.$guessedViewName, |
|
43 | + $basePath.$guessedViewName, |
|
44 | + $basePath.$guessedViewName.'.show', |
|
45 | + $basePath.'show', |
|
46 | 46 | ]; |
47 | 47 | |
48 | 48 | // In case the collection set is made out of pages, we'll also allow to use the |
49 | 49 | // generic collection page view for these sets as well as a fallback view |
50 | 50 | if ($this->viewable instanceof Set && $this->viewable->first() instanceof ViewableContract) { |
51 | - $viewPaths[] = $basePath . $guessedParentViewName . '.' . $this->viewable->first()->viewKey(); |
|
52 | - $viewPaths[] = $basePath . $this->viewable->first()->viewKey(); |
|
51 | + $viewPaths[] = $basePath.$guessedParentViewName.'.'.$this->viewable->first()->viewKey(); |
|
52 | + $viewPaths[] = $basePath.$this->viewable->first()->viewKey(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | foreach ($viewPaths as $viewPath) { |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | return $viewPath; |
61 | 61 | } |
62 | 62 | |
63 | - if (!view()->exists($basePath . 'show')) { |
|
64 | - throw new NotFoundView('Viewfile not found for [' . get_class($this->viewable) . ']. Make sure the view [' . $basePath . $guessedViewName . '] or the default view [' . $basePath . 'show] exists.'); |
|
63 | + if (!view()->exists($basePath.'show')) { |
|
64 | + throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the view ['.$basePath.$guessedViewName.'] or the default view ['.$basePath.'show] exists.'); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $this->model = $model; |
21 | 21 | $this->blacklist = $blacklist; |
22 | 22 | |
23 | - $this->slugResolver = function ($slug) { |
|
23 | + $this->slugResolver = function($slug) { |
|
24 | 24 | return Str::slug($slug); |
25 | 25 | }; |
26 | 26 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $i = 1; |
44 | 44 | |
45 | 45 | while (!$this->isSlugUnique($slug, $entity)) { |
46 | - $slug = $originalslug . '-' . $i; |
|
46 | + $slug = $originalslug.'-'.$i; |
|
47 | 47 | $i++; |
48 | 48 | } |
49 | 49 |
@@ -23,15 +23,15 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | foreach ($rules as $key => $rule) { |
26 | - $translationrules['trans.' . $locale . '.' . $key] = $rule; |
|
26 | + $translationrules['trans.'.$locale.'.'.$key] = $rule; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | foreach ($attributes as $key => $attribute) { |
30 | - $translationattributes['trans.' . $locale . '.' . $key] = $attribute; |
|
30 | + $translationattributes['trans.'.$locale.'.'.$key] = $attribute; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | foreach ($messages as $key => $message) { |
34 | - $translationmessages['trans.' . $locale . '.' . $key] = $message; |
|
34 | + $translationmessages['trans.'.$locale.'.'.$key] = $message; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $collection = NodeCollection::fromArray($items); |
27 | 27 | |
28 | - $collection->mapRecursive(function ($node) { |
|
28 | + $collection->mapRecursive(function($node) { |
|
29 | 29 | return $node->replaceEntry((new MenuItem())->entry($node)); |
30 | 30 | }); |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function items(): NodeCollection |
43 | 43 | { |
44 | 44 | if (!$this->includeHidden) { |
45 | - $this->collection = $this->collection->shake(function ($node) { |
|
45 | + $this->collection = $this->collection->shake(function($node) { |
|
46 | 46 | return !$node->hidden_in_menu && !$node->draft; |
47 | 47 | }); |
48 | 48 | } |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | $this->collection = $this->items(); |
56 | 56 | |
57 | 57 | if ($id) { |
58 | - $this->collection = $this->collection->prune(function ($node) use ($id) { |
|
58 | + $this->collection = $this->collection->prune(function($node) use ($id) { |
|
59 | 59 | return !in_array($id, $node->pluckAncestors('id')); |
60 | 60 | }); |
61 | 61 | } |
62 | 62 | |
63 | - $menu = $this->collection->mapRecursive(function ($node) { |
|
63 | + $menu = $this->collection->mapRecursive(function($node) { |
|
64 | 64 | $entry = $node->entry(); |
65 | 65 | $label = $entry->label; |
66 | - $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())) . '>' : ''; |
|
66 | + $entry->label = $node->depth() != 0 ? (str_repeat('-', $node->depth())).'>' : ''; |
|
67 | 67 | $entry->label .= $label; |
68 | 68 | |
69 | 69 | return $node->replaceEntry($entry); |
70 | 70 | }); |
71 | 71 | |
72 | 72 | $menuitems = collect(); |
73 | - $menu->flatten()->each(function ($node) use ($menuitems) { |
|
73 | + $menu->flatten()->each(function($node) use ($menuitems) { |
|
74 | 74 | $menuitems[] = [ |
75 | 75 | 'label' => $node->label, |
76 | 76 | 'id' => $node->id, |