@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return static::$managedModelKey; |
85 | 85 | } |
86 | 86 | |
87 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.'); |
|
87 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | public function flatReferenceLabel(): string |
125 | 125 | { |
126 | 126 | if ($this->exists) { |
127 | - $status = ! $this->isPublished() ? ' [' . $this->statusAsPlainLabel().']' : null; |
|
127 | + $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null; |
|
128 | 128 | |
129 | - return $this->title ? $this->title . $status : ''; |
|
129 | + return $this->title ? $this->title.$status : ''; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return ''; |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | { |
137 | 137 | $classKey = get_class($this); |
138 | 138 | if (property_exists($this, 'labelSingular')) { |
139 | - $labelSingular = $this->labelSingular; |
|
140 | - } else { |
|
139 | + $labelSingular = $this->labelSingular; |
|
140 | + }else { |
|
141 | 141 | $labelSingular = Str::singular($classKey); |
142 | 142 | } |
143 | 143 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | // If no view has been created for this page collection, we try once again to fetch the content value if any. This will silently fail |
53 | 53 | // if no content value is present. We don't consider the 'content' attribute to be a default as we do for module. |
54 | - return $this->map(function ($item) { |
|
54 | + return $this->map(function($item) { |
|
55 | 55 | return ($this->viewParent && $item instanceof ViewableContract) |
56 | 56 | ? $item->setViewParent($this->viewParent)->renderView() |
57 | 57 | : ($item->content ?? ''); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $currentPage = $currentPage ?? request()->get('page', 1); |
86 | 86 | $path = request()->path(); |
87 | - $items = array_slice($this->all(), ($currentPage - 1) * $perPage); |
|
87 | + $items = array_slice($this->all(), ($currentPage-1) * $perPage); |
|
88 | 88 | |
89 | 89 | return (new \Illuminate\Pagination\Paginator($items, $perPage ?? $this->paginateSetting('perPage', '12'), $currentPage))->setPath($path); |
90 | 90 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $currentPage = $currentPage ?? request()->get('page', 1); |
103 | 103 | $path = '/'.request()->path(); |
104 | - $items = array_slice($this->all(), ($currentPage - 1) * $perPage, $perPage); |
|
104 | + $items = array_slice($this->all(), ($currentPage-1) * $perPage, $perPage); |
|
105 | 105 | |
106 | 106 | return (new \Illuminate\Pagination\LengthAwarePaginator($items, $this->paginateSetting('total', $this->count()), $perPage ?? $this->paginateSetting('perPage', '12'), $currentPage))->setPath($path); |
107 | 107 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | // Constraints |
41 | 41 | if (!isset($values['action'])) { |
42 | - throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: ' . print_r($values, true)); |
|
42 | + throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: '.print_r($values, true)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return new static( |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | { |
55 | 55 | $sets = config('thinktomorrow.chief.sets', []); |
56 | 56 | |
57 | - return collect($sets)->map(function ($set, $key) { |
|
57 | + return collect($sets)->map(function($set, $key) { |
|
58 | 58 | return SetReference::fromArray($key, $set); |
59 | 59 | }); |
60 | 60 | } |
61 | 61 | |
62 | 62 | public static function find($key): ?SetReference |
63 | 63 | { |
64 | - return static::all()->filter(function ($ref) use ($key) { |
|
64 | + return static::all()->filter(function($ref) use ($key) { |
|
65 | 65 | return $ref->key() == $key; |
66 | 66 | })->first(); |
67 | 67 | } |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->validateAction($class, $method); |
80 | 80 | |
81 | - $result = call_user_func_array([app($class),$method], $this->parameters($class, $method, $parent)); |
|
81 | + $result = call_user_func_array([app($class), $method], $this->parameters($class, $method, $parent)); |
|
82 | 82 | |
83 | - if (! $result instanceof Set && $result instanceof Collection) { |
|
83 | + if (!$result instanceof Set && $result instanceof Collection) { |
|
84 | 84 | return new Set($result->all(), $this->key); |
85 | 85 | } |
86 | 86 | |
87 | - if (! $result instanceof Set && $result instanceof Paginator) { |
|
87 | + if (!$result instanceof Set && $result instanceof Paginator) { |
|
88 | 88 | return new Set($result->all(), $this->key, [ |
89 | 89 | 'paginate' => [ |
90 | 90 | 'total' => $result->total(), |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | private static function validateAction($class, $method) |
154 | 154 | { |
155 | - if (! class_exists($class)) { |
|
155 | + if (!class_exists($class)) { |
|
156 | 156 | throw new \InvalidArgumentException('The class ['.$class.'] isn\'t a valid class reference or does not exist in the chief-settings.sets config entry.'); |
157 | 157 | } |
158 | 158 |
@@ -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)); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $genericModelInstance = $this->modelInstance(); |
17 | 17 | |
18 | 18 | // Generic model details |
19 | - $id = Str::slug($this->registration->key(). ($this->hasExistingModel() ? '-'. $this->existingModel()->id : '')); |
|
19 | + $id = Str::slug($this->registration->key().($this->hasExistingModel() ? '-'.$this->existingModel()->id : '')); |
|
20 | 20 | $key = $this->registration->key(); |
21 | 21 | $labelSingular = property_exists($genericModelInstance, 'labelSingular') ? $genericModelInstance->labelSingular : Str::singular($key); |
22 | 22 | $labelPlural = property_exists($genericModelInstance, 'labelPlural') ? $genericModelInstance->labelPlural : Str::plural($key); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return $this->indexPagination($builder); |
88 | 88 | } |
89 | 89 | |
90 | - return $builder->get()->map(function ($model) { |
|
90 | + return $builder->get()->map(function($model) { |
|
91 | 91 | return (new static($this->registration))->manage($model); |
92 | 92 | }); |
93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $paginator = $builder->paginate($this->pageCount); |
117 | 117 | |
118 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
118 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
119 | 119 | return (new static($this->registration))->manage($model); |
120 | 120 | }); |
121 | 121 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | public function guard($verb): Manager |
190 | 190 | { |
191 | - if (! $this->can($verb)) { |
|
191 | + if (!$this->can($verb)) { |
|
192 | 192 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
193 | 193 | } |
194 | 194 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $fields = $this->fields(); |
212 | 212 | |
213 | 213 | foreach ($this->assistantsAsClassNames() as $assistantClass) { |
214 | - if (! method_exists($assistantClass, 'fields')) { |
|
214 | + if (!method_exists($assistantClass, 'fields')) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | static::$bootedTraitMethods[$baseMethod] = []; |
304 | 304 | |
305 | 305 | foreach (class_uses_recursive($class) as $trait) { |
306 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
306 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
307 | 307 | |
308 | - if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
308 | + if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
|
309 | 309 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
310 | 310 | } |
311 | 311 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Thinktomorrow\Chief\HealthMonitor\Checks; |
4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | private function get_http_response_code(string $url) |
16 | 16 | { |
17 | - if ($url =='') { |
|
17 | + if ($url == '') { |
|
18 | 18 | return false; |
19 | 19 | } |
20 | 20 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function message(): string |
34 | 34 | { |
35 | - return 'Het lijkt erop dat de homepagina niet meer bereikbaar is. <a href="'. route('chief.back.settings.edit') .'" class="text-secondary-800 underline hover:text-white">Kies een nieuwe</a>.'; |
|
35 | + return 'Het lijkt erop dat de homepagina niet meer bereikbaar is. <a href="'.route('chief.back.settings.edit').'" class="text-secondary-800 underline hover:text-white">Kies een nieuwe</a>.'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function notifiers(): array |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Thinktomorrow\Chief\HealthMonitor\Checks; |
4 | 4 |