@@ -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. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public static function onlineModels(bool $onlySingles = false, Model $ignoredModel = null): Collection |
41 | 41 | { |
42 | - $models = chiefMemoize('all-online-models', function () use ($onlySingles) { |
|
42 | + $models = chiefMemoize('all-online-models', function() use ($onlySingles) { |
|
43 | 43 | $builder = UrlRecord::whereNull('redirect_id') |
44 | 44 | ->select('model_type', 'model_id') |
45 | 45 | ->groupBy('model_type', 'model_id'); |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | $builder->where('model_type', 'singles'); |
49 | 49 | } |
50 | 50 | |
51 | - return $builder->get()->mapToGroups(function ($record) { |
|
51 | + return $builder->get()->mapToGroups(function($record) { |
|
52 | 52 | return [$record->model_type => $record->model_id]; |
53 | - })->map(function ($record, $key) { |
|
53 | + })->map(function($record, $key) { |
|
54 | 54 | return Morphables::instance($key)->find($record->toArray()); |
55 | - })->map->reject(function ($model) { |
|
55 | + })->map->reject(function($model) { |
|
56 | 56 | return is_null($model) || !$model->isPublished(); // Invalid references to archived or removed models where url record still exists. |
57 | 57 | })->flatten(); |
58 | 58 | }, [$onlySingles]); |
59 | 59 | |
60 | 60 | if ($ignoredModel) { |
61 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
61 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
62 | 62 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
63 | 63 | }); |
64 | 64 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | public function assistant(string $assistantKey): Assistant |
52 | 52 | { |
53 | 53 | if (!$this->isAssistedBy($assistantKey)) { |
54 | - throw new MissingAssistant('No assistant [' . $assistantKey . '] registered on manager ' . static::class); |
|
54 | + throw new MissingAssistant('No assistant ['.$assistantKey.'] registered on manager '.static::class); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $instance = app($this->getAssistantClass($assistantKey)); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug. |
32 | 32 | if ($model instanceof Module) { |
33 | 33 | $model->update([ |
34 | - 'slug' => $model->slug . $this->appendDeleteMarker(), |
|
34 | + 'slug' => $model->slug.$this->appendDeleteMarker(), |
|
35 | 35 | ]); |
36 | 36 | } |
37 | 37 | |
@@ -58,6 +58,6 @@ discard block |
||
58 | 58 | |
59 | 59 | private function appendDeleteMarker(): string |
60 | 60 | { |
61 | - return '_DELETED_' . time(); |
|
61 | + return '_DELETED_'.time(); |
|
62 | 62 | } |
63 | 63 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ->performedOn($this->manager->existingModel()) |
60 | 60 | ->log('published'); |
61 | 61 | |
62 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title . ' is online gezet.'); |
|
62 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is online gezet.'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function unpublish() |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | ->performedOn($this->manager->existingModel()) |
74 | 74 | ->log('unpublished'); |
75 | 75 | |
76 | - return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title . ' is offline gehaald.'); |
|
76 | + return redirect()->to($this->manager->route('edit'))->with('messages.success', $this->manager->details()->title.' is offline gehaald.'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function findAll(): Collection |
80 | 80 | { |
81 | - return $this->manager->existingModel()->published()->get()->map(function ($model) { |
|
81 | + return $this->manager->existingModel()->published()->get()->map(function($model) { |
|
82 | 82 | return $this->managers->findByModel($model); |
83 | 83 | }); |
84 | 84 | } |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | $class = 'text-warning'; |
130 | 130 | } |
131 | 131 | |
132 | - $statusAsLabel = '<span class="' . $class . '">' . $label . '</span>'; |
|
132 | + $statusAsLabel = '<span class="'.$class.'">'.$label.'</span>'; |
|
133 | 133 | |
134 | 134 | if (!$plain && $this->hasPreviewUrl()) { |
135 | - $statusAsLabel = '<a href="' . $this->previewUrl() . '" target="_blank">' . $statusAsLabel . '</a>'; |
|
135 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $statusAsLabel; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $images = []; |
26 | 26 | $locale = $locale ?? app()->getLocale(); |
27 | 27 | |
28 | - $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function ($asset) use ($locale) { |
|
28 | + $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function($asset) use ($locale) { |
|
29 | 29 | return $asset->pivot->locale == $locale; |
30 | 30 | })->sortBy('pivot.order'); |
31 | 31 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | private function addCustomValidationMessage($attribute, $params, $validator): void |
84 | 84 | { |
85 | 85 | $validator->setCustomMessages([ |
86 | - 'imagefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: ' . implode(', ', $this->humanReadableParams($params)), |
|
86 | + 'imagefield_dimensions' => 'De :attribute heeft niet de juiste afmetingen: '.implode(', ', $this->humanReadableParams($params)), |
|
87 | 87 | ]); |
88 | 88 | |
89 | 89 | if (!isset($validator->customAttributes[$attribute])) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Therefore the index of these modules is at the modules tab of this page model. |
34 | 34 | */ |
35 | 35 | if ($verb == 'index' && $this->model->isPageSpecific()) { |
36 | - return app(Managers::class)->findByModel($this->model->page)->route('edit') . '#eigen-modules'; |
|
36 | + return app(Managers::class)->findByModel($this->model->page)->route('edit').'#eigen-modules'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $routes = [ |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if (is_array_empty($translation)) { |
154 | 154 | |
155 | 155 | // Nullify all values |
156 | - $trans[$locale] = array_map(function ($value) { |
|
156 | + $trans[$locale] = array_map(function($value) { |
|
157 | 157 | return null; |
158 | 158 | }, $translation); |
159 | 159 | continue; |