@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | $assets = Asset::with('media')->orderBy('created_at', 'DESC')->select('assets.*'); |
22 | 22 | |
23 | 23 | if ($search) { |
24 | - $assets->whereHas('media', function (Builder $query) use ($search) { |
|
25 | - $query->where('file_name', 'LIKE', '%' . $search . '%'); |
|
24 | + $assets->whereHas('media', function(Builder $query) use ($search) { |
|
25 | + $query->where('file_name', 'LIKE', '%'.$search.'%'); |
|
26 | 26 | }); |
27 | 27 | } |
28 | 28 | |
29 | 29 | if ($unused) { |
30 | - $assets->whereNotExists(function ($query) { |
|
30 | + $assets->whereNotExists(function($query) { |
|
31 | 31 | $query->select(DB::raw(1)) |
32 | 32 | ->from('asset_pivots') |
33 | 33 | ->whereRaw('asset_pivots.asset_id = assets.id') |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | }); |
36 | 36 | } |
37 | 37 | |
38 | - if($owner){ |
|
38 | + if ($owner) { |
|
39 | 39 | $owner = ModelReference::fromString($owner)->instance(); |
40 | 40 | $modelAssets = collect(); |
41 | 41 | $modelAssets = $modelAssets->merge($owner->assets()); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | { |
55 | 55 | foreach ($modelReferences as $locale => $modelReferenceString) { |
56 | 56 | if (!$modelReferenceString) { |
57 | - throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale ' . $locale . ' is missing.'); |
|
57 | + throw new \InvalidArgumentException('Homepage setting value cannot be empty. Value for locale '.$locale.' is missing.'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | public static function toSelectValues(Collection $collection): Collection |
12 | 12 | { |
13 | - return $collection->map(function (ProvidesModelReference $item) { |
|
13 | + return $collection->map(function(ProvidesModelReference $item) { |
|
14 | 14 | return [ |
15 | 15 | 'id' => $item->modelReference()->get(), |
16 | 16 | 'label' => $item->modelReferenceLabel(), |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | { |
24 | 24 | $grouped = []; |
25 | 25 | |
26 | - static::toSelectValues($collection)->each(function ($item) use (&$grouped) { |
|
26 | + static::toSelectValues($collection)->each(function($item) use (&$grouped) { |
|
27 | 27 | if (isset($grouped[$item['group']])) { |
28 | 28 | $grouped[$item['group']]['values'][] = $item; |
29 | - } else { |
|
29 | + }else { |
|
30 | 30 | $grouped[$item['group']] = ['group' => $item['group'], 'values' => [$item]]; |
31 | 31 | } |
32 | 32 | }); |
@@ -21,16 +21,16 @@ |
||
21 | 21 | $referenceStrings = []; |
22 | 22 | } |
23 | 23 | |
24 | - return (new Collection($referenceStrings))->reject(function ($referenceString) { |
|
24 | + return (new Collection($referenceStrings))->reject(function($referenceString) { |
|
25 | 25 | return is_null($referenceString); |
26 | - })->map(function ($referenceString) { |
|
26 | + })->map(function($referenceString) { |
|
27 | 27 | return ModelReference::fromString($referenceString)->instance(); |
28 | 28 | }); |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function toModelReferences(): Collection |
32 | 32 | { |
33 | - return (new Collection($this->all()))->map(function (ProvidesModelReference $item) { |
|
33 | + return (new Collection($this->all()))->map(function(ProvidesModelReference $item) { |
|
34 | 34 | return $item->modelReference()->get(); |
35 | 35 | }); |
36 | 36 | } |
@@ -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; |