@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | public static function fromString(string $reference): self |
22 | 22 | { |
23 | 23 | if (false == strpos($reference, '@')) { |
24 | - throw new \InvalidArgumentException('Invalid reference composition. A model reference should honour schema <class>@<id>. [' . $reference . '] was passed instead.'); |
|
24 | + throw new \InvalidArgumentException('Invalid reference composition. A model reference should honour schema <class>@<id>. ['.$reference.'] was passed instead.'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | list($className, $id) = explode('@', $reference); |
28 | 28 | |
29 | - return new static($className, (int) $id); |
|
29 | + return new static($className, (int)$id); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function get(): string |
53 | 53 | { |
54 | - return $this->className . '@' . $this->id; |
|
54 | + return $this->className.'@'.$this->id; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function equals($other): bool |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return static::$managedModelKey; |
99 | 99 | } |
100 | 100 | |
101 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class . '.'); |
|
101 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | public function modelReferenceLabel(): string |
139 | 139 | { |
140 | 140 | if ($this->exists) { |
141 | - $status = !$this->isPublished() ? ' [' . $this->statusAsPlainLabel() . ']' : null; |
|
141 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null; |
|
142 | 142 | |
143 | - return $this->title ? $this->title . $status : ''; |
|
143 | + return $this->title ? $this->title.$status : ''; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return ''; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $classKey = get_class($this); |
152 | 152 | if (property_exists($this, 'labelSingular')) { |
153 | 153 | $labelSingular = $this->labelSingular; |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | $labelSingular = Str::singular($classKey); |
156 | 156 | } |
157 | 157 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $locale = app()->getLocale(); |
171 | 171 | } |
172 | 172 | try { |
173 | - $memoizedKey = $this->getMorphClass() . '-' . $this->id . '-' . $locale; |
|
173 | + $memoizedKey = $this->getMorphClass().'-'.$this->id.'-'.$locale; |
|
174 | 174 | |
175 | 175 | if (isset(static::$cachedUrls[$memoizedKey])) { |
176 | 176 | return static::$cachedUrls[$memoizedKey]; |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | public function statusAsLabel() |
227 | 227 | { |
228 | 228 | if ($this->isPublished()) { |
229 | - return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>'; |
|
229 | + return '<a href="'.$this->url().'" target="_blank"><em>online</em></a>'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | if ($this->isDraft()) { |
233 | - return '<a href="' . $this->url() . '" target="_blank" class="text-error"><em>offline</em></a>'; |
|
233 | + return '<a href="'.$this->url().'" target="_blank" class="text-error"><em>offline</em></a>'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | if ($this->isArchived()) { |
@@ -40,9 +40,9 @@ |
||
40 | 40 | if ($request->filled('template')) { |
41 | 41 | $this->applyTemplate->handle( |
42 | 42 | ModelReference::fromString($request->input('template'))->className(), |
43 | - (string) ModelReference::fromString($request->input('template'))->id(), |
|
43 | + (string)ModelReference::fromString($request->input('template'))->id(), |
|
44 | 44 | get_class($manager->existingModel()), |
45 | - (string) $manager->existingModel()->id |
|
45 | + (string)$manager->existingModel()->id |
|
46 | 46 | ); |
47 | 47 | } |
48 | 48 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $availableChildren = AvailableChildren::forParent($model); |
51 | 51 | |
52 | - $modules = $availableChildren->onlyModules()->reject(function ($module) use ($model) { |
|
52 | + $modules = $availableChildren->onlyModules()->reject(function($module) use ($model) { |
|
53 | 53 | return $module->owner_id != null && $module->owner_id != $model->id; |
54 | 54 | }); |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $available_sets = ModelReferencePresenter::toGroupedSelectValues($availableChildren->onlySets())->toArray(); |
59 | 59 | |
60 | 60 | // Current sections |
61 | - $sections = $model->children()->map(function ($section, $index) { |
|
61 | + $sections = $model->children()->map(function($section, $index) { |
|
62 | 62 | if ($section instanceof TranslatableContract) { |
63 | 63 | $section->injectTranslationForForm(); |
64 | 64 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | |
197 | - $child = $children->first(function ($c) use ($reference) { |
|
197 | + $child = $children->first(function($c) use ($reference) { |
|
198 | 198 | return $c->modelReference()->get() == $reference; |
199 | 199 | }); |
200 | 200 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | private function stripTagsBlacklist($value, $blacklist = []) |
246 | 246 | { |
247 | 247 | foreach ($blacklist as $tag) { |
248 | - $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value); |
|
248 | + $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | return $value; |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function onlyModules(): Collection |
36 | 36 | { |
37 | - return $this->collection()->reject(function ($item) { |
|
37 | + return $this->collection()->reject(function($item) { |
|
38 | 38 | return ($item instanceof ActsAsParent); |
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function onlyPages(): Collection |
43 | 43 | { |
44 | - return $this->collection()->filter(function ($item) { |
|
44 | + return $this->collection()->filter(function($item) { |
|
45 | 45 | return ($item instanceof ActsAsParent); |
46 | 46 | }); |
47 | 47 | } |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | // } |
97 | 97 | |
98 | 98 | // Remove duplicate models |
99 | - $collection = $collection->unique(function ($model) { |
|
99 | + $collection = $collection->unique(function($model) { |
|
100 | 100 | return (new ModelReference(get_class($model), $model->id))->get(); |
101 | 101 | }); |
102 | 102 | |
103 | 103 | // Filter out our parent |
104 | - return $this->collection = $collection->reject(function ($item) { |
|
104 | + return $this->collection = $collection->reject(function($item) { |
|
105 | 105 | return ($item instanceof $this->parent && $item->id == $this->parent->id); |
106 | 106 | })->values(); |
107 | 107 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public static function fromModel(FragmentModel $fragmentModel): self |
36 | 36 | { |
37 | - return new static($fragmentModel->key, $fragmentModel->values->all(), new Fields(), (int) $fragmentModel->id); |
|
37 | + return new static($fragmentModel->key, $fragmentModel->values->all(), new Fields(), (int)$fragmentModel->id); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public static function fromNew(string $key, array $values): self |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $modelId = $payload['modelId']; |
57 | 57 | unset($payload['modelId']); |
58 | 58 | |
59 | - return new static($key, $payload, new Fields(), (int) $modelId); |
|
59 | + return new static($key, $payload, new Fields(), (int)$modelId); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function setFields(Fields $fields): self |
@@ -13,15 +13,15 @@ |
||
13 | 13 | public function saveFragmentFields(FragmentField $fragmentField, Request $request) |
14 | 14 | { |
15 | 15 | $payload = $request->input($fragmentField->getDottedName(), []); |
16 | - $imagePayload = $request->input('images.' . $fragmentField->getDottedName(), []); |
|
16 | + $imagePayload = $request->input('images.'.$fragmentField->getDottedName(), []); |
|
17 | 17 | |
18 | 18 | // Compose Fragment instances for each payload entry |
19 | - $fragments = array_map(function ($fragmentPayload) use ($fragmentField) { |
|
19 | + $fragments = array_map(function($fragmentPayload) use ($fragmentField) { |
|
20 | 20 | return Fragment::fromRequestPayload($fragmentField->getKey(), $fragmentPayload); // (new Fragment($field->getKey(), $fragmentPayload)); |
21 | 21 | }, $payload); |
22 | 22 | |
23 | 23 | // remove all dead fragments |
24 | - $this->existingModel()->removeAllFragments($fragmentField->getKey(), array_map(function (Fragment $fragment) { |
|
24 | + $this->existingModel()->removeAllFragments($fragmentField->getKey(), array_map(function(Fragment $fragment) { |
|
25 | 25 | return $fragment->hasModelId() ? $fragment->getModelId() : null; |
26 | 26 | }, $fragments)); |
27 | 27 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | ], $fragment->getValues()); |
25 | 25 | |
26 | 26 | if ($fragment->hasModelId()) { |
27 | - $model =FragmentModel::find($fragment->getModelId()); |
|
27 | + $model = FragmentModel::find($fragment->getModelId()); |
|
28 | 28 | $model->update($values); |
29 | 29 | |
30 | 30 | return $model->id; |