@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | return static::$managedModelKey; |
102 | 102 | } |
103 | 103 | |
104 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class . '.'); |
|
104 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | public function flatReferenceLabel(): string |
142 | 142 | { |
143 | 143 | if ($this->exists) { |
144 | - $status = !$this->isPublished() ? ' [' . $this->statusAsPlainLabel() . ']' : null; |
|
144 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null; |
|
145 | 145 | |
146 | - return $this->title ? $this->title . $status : ''; |
|
146 | + return $this->title ? $this->title.$status : ''; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return ''; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $classKey = get_class($this); |
155 | 155 | if (property_exists($this, 'labelSingular')) { |
156 | 156 | $labelSingular = $this->labelSingular; |
157 | - } else { |
|
157 | + }else { |
|
158 | 158 | $labelSingular = Str::singular($classKey); |
159 | 159 | } |
160 | 160 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $locale = app()->getLocale(); |
195 | 195 | } |
196 | 196 | try { |
197 | - $memoizedKey = $this->getMorphClass() . '-' . $this->id . '-' . $locale; |
|
197 | + $memoizedKey = $this->getMorphClass().'-'.$this->id.'-'.$locale; |
|
198 | 198 | |
199 | 199 | if (isset(static::$cachedUrls[$memoizedKey])) { |
200 | 200 | return static::$cachedUrls[$memoizedKey]; |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | public function statusAsLabel() |
251 | 251 | { |
252 | 252 | if ($this->isPublished()) { |
253 | - return '<a href="' . $this->url() . '" target="_blank"><em>online</em></a>'; |
|
253 | + return '<a href="'.$this->url().'" target="_blank"><em>online</em></a>'; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if ($this->isDraft()) { |
257 | - return '<a href="' . $this->url() . '" target="_blank" class="text-error"><em>offline</em></a>'; |
|
257 | + return '<a href="'.$this->url().'" target="_blank" class="text-error"><em>offline</em></a>'; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if ($this->isArchived()) { |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | */ |
38 | 38 | if ($verb == 'index' && $this->model->isPageSpecific()) { |
39 | 39 | if (!$this->model->page) { |
40 | - throw new \RuntimeException('Cannot retrieve parent for page specific module [type: ' . $this->registration->key() . ', id: ' . $this->existingModel()->id . ']'); |
|
40 | + throw new \RuntimeException('Cannot retrieve parent for page specific module [type: '.$this->registration->key().', id: '.$this->existingModel()->id.']'); |
|
41 | 41 | } |
42 | 42 | |
43 | - return app(Managers::class)->findByModel($this->model->page)->route('edit') . '#eigen-modules'; |
|
43 | + return app(Managers::class)->findByModel($this->model->page)->route('edit').'#eigen-modules'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $routes = [ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (is_array_empty($translation)) { |
161 | 161 | |
162 | 162 | // Nullify all values |
163 | - $trans[$locale] = array_map(function ($value) { |
|
163 | + $trans[$locale] = array_map(function($value) { |
|
164 | 164 | return null; |
165 | 165 | }, $translation); |
166 | 166 | continue; |
@@ -40,9 +40,9 @@ |
||
40 | 40 | if ($request->filled('template')) { |
41 | 41 | $this->applyTemplate->handle( |
42 | 42 | FlatReferenceFactory::fromString($request->input('template'))->className(), |
43 | - (string) FlatReferenceFactory::fromString($request->input('template'))->id(), |
|
43 | + (string)FlatReferenceFactory::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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | - $availableApplicatorsString = implode(array_map(function ($applicator) { return get_class($applicator);}, $this->applicators), ','); |
|
39 | + $availableApplicatorsString = implode(array_map(function($applicator) { return get_class($applicator); }, $this->applicators), ','); |
|
40 | 40 | |
41 | 41 | throw new \RuntimeException("No proper template applicator found. $sourceClassName [$sourceId] cannot be applied as template. Available applicators: [$availableApplicatorsString]"); |
42 | 42 | } |
@@ -53,13 +53,13 @@ |
||
53 | 53 | |
54 | 54 | if ($child instanceof Module && $child->isPageSpecific()) { |
55 | 55 | $duplicatedChild = $child::create([ |
56 | - 'slug' => $targetModel->title ? $targetModel->title . '-' . $child->slug : $child->slug . '-copy', |
|
56 | + 'slug' => $targetModel->title ? $targetModel->title.'-'.$child->slug : $child->slug.'-copy', |
|
57 | 57 | 'owner_id' => $targetModel->id, |
58 | 58 | 'owner_type' => $targetModel->getMorphClass() |
59 | 59 | ]); |
60 | 60 | |
61 | 61 | $this->moduleTemplateApplicator->handle($child, $duplicatedChild); |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | $duplicatedChild = $child; |
64 | 64 | } |
65 | 65 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public static function modelsByType(array $types, Model $ignoredModel = null, bool $online = true) |
91 | 91 | { |
92 | - $models = chiefMemoize('all-online-models-' . implode('_', $types), function () use ($types, $online) { |
|
92 | + $models = chiefMemoize('all-online-models-'.implode('_', $types), function() use ($types, $online) { |
|
93 | 93 | $builder = UrlRecord::whereNull('redirect_id') |
94 | 94 | ->select('model_type', 'model_id') |
95 | 95 | ->groupBy('model_type', 'model_id'); |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | $builder->whereIn('model_type', $types); |
99 | 99 | } |
100 | 100 | |
101 | - return $builder->get()->mapToGroups(function ($record) { |
|
101 | + return $builder->get()->mapToGroups(function($record) { |
|
102 | 102 | return [$record->model_type => $record->model_id]; |
103 | - })->map(function ($record, $key) { |
|
103 | + })->map(function($record, $key) { |
|
104 | 104 | return Morphables::instance($key)->find($record->toArray()); |
105 | - })->map->reject(function ($model) use ($online) { |
|
105 | + })->map->reject(function($model) use ($online) { |
|
106 | 106 | if ($online) { |
107 | 107 | return is_null($model) || !$model->isPublished(); |
108 | 108 | } // Invalid references to archived or removed models where url record still exists. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | }); |
113 | 113 | |
114 | 114 | if ($ignoredModel) { |
115 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
115 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
116 | 116 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
117 | 117 | }); |
118 | 118 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $manifestPath = '/chief-assets/back'; |
21 | 21 | |
22 | 22 | // Manifest expects each entry to start with a leading slash - we make sure to deduplicate the manifest path. |
23 | - $entry = str_replace($manifestPath, '', '/' . ltrim($filepath, '/')); |
|
23 | + $entry = str_replace($manifestPath, '', '/'.ltrim($filepath, '/')); |
|
24 | 24 | |
25 | 25 | try { |
26 | 26 | // Paths should be given relative to the manifestpath so make sure to remove the basepath |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } catch (\Exception $e) { |
29 | 29 | \Illuminate\Support\Facades\Log::error($e); |
30 | 30 | |
31 | - return $manifestPath . $entry; |
|
31 | + return $manifestPath.$entry; |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $teaser = mb_substr($text, 0, $max, 'utf-8'); |
118 | 118 | |
119 | - return strlen($text) <= $max ? $teaser : $teaser . $ending; |
|
119 | + return strlen($text) <= $max ? $teaser : $teaser.$ending; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | 'fragment', |
248 | 248 | ], null), $parsed_url, $overrides); |
249 | 249 | |
250 | - $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null; |
|
251 | - $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null; |
|
252 | - $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null; |
|
250 | + $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null; |
|
251 | + $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null; |
|
252 | + $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null; |
|
253 | 253 | |
254 | - $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path']; |
|
254 | + $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path']; |
|
255 | 255 | $current_query = []; |
256 | 256 | |
257 | 257 | $_query = explode('&', $parsed_url['query']); |
258 | 258 | |
259 | - array_map(function ($v) use (&$current_query) { |
|
259 | + array_map(function($v) use (&$current_query) { |
|
260 | 260 | if (!$v) { |
261 | 261 | return; |
262 | 262 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $query = urldecode(http_build_query(array_merge($current_query, $query_params))); |
276 | 276 | |
277 | - return $baseurl . '?' . $query . $fragment; |
|
277 | + return $baseurl.'?'.$query.$fragment; |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 |
@@ -29,12 +29,12 @@ |
||
29 | 29 | |
30 | 30 | public function icon(): string |
31 | 31 | { |
32 | - if(isset($this->mapping[$this->mimetype])) { |
|
32 | + if (isset($this->mapping[$this->mimetype])) { |
|
33 | 33 | return $this->mapping[$this->mimetype]; |
34 | 34 | } |
35 | 35 | |
36 | - foreach($this->mapping as $mimetype => $icon) { |
|
37 | - if(Str::contains($this->mimetype, $mimetype)) { |
|
36 | + foreach ($this->mapping as $mimetype => $icon) { |
|
37 | + if (Str::contains($this->mimetype, $mimetype)) { |
|
38 | 38 | return $icon; |
39 | 39 | } |
40 | 40 | } |
@@ -22,24 +22,24 @@ |
||
22 | 22 | public function handle(Request $request) |
23 | 23 | { |
24 | 24 | // Strict protection enabled: we won't remove assets who are still being used... |
25 | - $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId){ |
|
25 | + $assetIds = collect($request->input('asset_ids', []))->reject(function($assetId) { |
|
26 | 26 | return DB::table('asset_pivots') |
27 | 27 | ->where('asset_id', $assetId) |
28 | 28 | ->where('unused', 0) |
29 | 29 | ->exists(); |
30 | 30 | })->toArray(); |
31 | 31 | |
32 | - if($assetIds) |
|
32 | + if ($assetIds) |
|
33 | 33 | { |
34 | - foreach($assetIds as $k => $assetId) { |
|
35 | - try{ |
|
34 | + foreach ($assetIds as $k => $assetId) { |
|
35 | + try { |
|
36 | 36 | $this->deleteAsset->remove($assetId); |
37 | - } catch(FileNotAccessibleException $e) { |
|
37 | + } catch (FileNotAccessibleException $e) { |
|
38 | 38 | unset($assetIds[$k]); // So our count of removed assets is correct in the log. |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - Audit::activity()->log('removed ' . count($assetIds) . ' assets from the mediagallery.'); |
|
42 | + Audit::activity()->log('removed '.count($assetIds).' assets from the mediagallery.'); |
|
43 | 43 | |
44 | 44 | return true; |
45 | 45 | } |