@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function get(): string |
36 | 36 | { |
37 | - $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : ''; |
|
37 | + $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : ''; |
|
38 | 38 | $guessedParentViewName = $this->parent ? $this->parent->viewKey() : ''; |
39 | 39 | $guessedViewName = $this->viewable->viewKey(); |
40 | 40 | |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | foreach ($viewPaths as $viewPath) { |
56 | - if (! view()->exists($viewPath)) { |
|
56 | + if (!view()->exists($viewPath)) { |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
60 | 60 | return $viewPath; |
61 | 61 | } |
62 | 62 | |
63 | - if (! view()->exists($basePath.'show')){ |
|
63 | + if (!view()->exists($basePath.'show')) { |
|
64 | 64 | throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the default view ['.$basePath.'show] exists.'); |
65 | 65 | } |
66 | 66 | } |
@@ -39,7 +39,9 @@ |
||
39 | 39 | |
40 | 40 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
41 | 41 | // we wont be trimming the slash |
42 | - if($slug === '/') return $slug; |
|
42 | + if($slug === '/') { |
|
43 | + return $slug; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | if ($this->startsWithBaseUrlSegment($slug)) { |
45 | 47 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // If this is a '/' slug, it indicates the homepage for this locale. In this case, |
51 | 51 | // we wont be trimming the slash |
52 | - if($slug === '/') return $slug; |
|
52 | + if ($slug === '/') return $slug; |
|
53 | 53 | |
54 | 54 | if ($this->startsWithBaseUrlSegment($slug)) { |
55 | 55 | $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'baseUrlSegment' => $this->baseUrlSegment, |
80 | 80 | 'hint' => null, // Hint placeholder to show url hint when it already exists |
81 | 81 | 'is_homepage' => ($this->value() === '/'), |
82 | - 'show' => !!$this->value(),// show input field or not |
|
82 | + 'show' => !!$this->value(), // show input field or not |
|
83 | 83 | ]); |
84 | 84 | } |
85 | 85 | } |
@@ -83,12 +83,12 @@ |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $manager = new \ReflectionClass($managerClass); |
86 | - if (! $manager->implementsInterface(Manager::class)) { |
|
86 | + if (!$manager->implementsInterface(Manager::class)) { |
|
87 | 87 | throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.'); |
88 | 88 | } |
89 | 89 | |
90 | 90 | $model = new \ReflectionClass($modelClass); |
91 | - if (! $model->implementsInterface(ManagedModel::class)) { |
|
91 | + if (!$model->implementsInterface(ManagedModel::class)) { |
|
92 | 92 | throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.'); |
93 | 93 | } |
94 | 94 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | |
124 | 124 | public function offsetSet($offset, $value) |
125 | 125 | { |
126 | - if (! $value instanceof Field) { |
|
127 | - throw new \InvalidArgumentException('Passed value must be of type ' . Field::class); |
|
126 | + if (!$value instanceof Field) { |
|
127 | + throw new \InvalidArgumentException('Passed value must be of type '.Field::class); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $this->fields[$offset] = $value; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | private function validateFields(array $fields) |
155 | 155 | { |
156 | - array_map(function (Field $field) { |
|
156 | + array_map(function(Field $field) { |
|
157 | 157 | }, $fields); |
158 | 158 | } |
159 | 159 |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | { |
64 | 64 | $permission = 'update-page'; |
65 | 65 | |
66 | - if (in_array($verb, ['index','show'])) { |
|
66 | + if (in_array($verb, ['index', 'show'])) { |
|
67 | 67 | $permission = 'view-page'; |
68 | - } elseif (in_array($verb, ['create','store'])) { |
|
68 | + } elseif (in_array($verb, ['create', 'store'])) { |
|
69 | 69 | $permission = 'create-page'; |
70 | 70 | } elseif (in_array($verb, ['delete'])) { |
71 | 71 | $permission = 'delete-page'; |
72 | 72 | } |
73 | 73 | |
74 | - if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
74 | + if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
75 | 75 | throw NotAllowedManagerRoute::notAllowedPermission($permission, $this); |
76 | 76 | } |
77 | 77 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function saveFields(Request $request) |
104 | 104 | { |
105 | 105 | // Store the morph_key upon creation |
106 | - if (! $this->model->morph_key) { |
|
106 | + if (!$this->model->morph_key) { |
|
107 | 107 | $this->model->morph_key = $this->model->morphKey(); |
108 | 108 | } |
109 | 109 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if (is_array_empty($translation)) { |
143 | 143 | |
144 | 144 | // Nullify all values |
145 | - $trans[$locale] = array_map(function ($value) { |
|
145 | + $trans[$locale] = array_map(function($value) { |
|
146 | 146 | return null; |
147 | 147 | }, $translation); |
148 | 148 | continue; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Thinktomorrow\Chief\Fields\Types; |
6 | 6 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $images = [$this->key() => []]; |
32 | 32 | |
33 | - foreach($model->getAllFiles()->groupBy('pivot.type') as $type => $assetsByType) { |
|
33 | + foreach ($model->getAllFiles()->groupBy('pivot.type') as $type => $assetsByType) { |
|
34 | 34 | foreach ($assetsByType as $asset) { |
35 | 35 | $images[$type][] = (object)[ |
36 | 36 | 'id' => $asset->id, |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $this->filters()->apply($builder); |
74 | 74 | |
75 | 75 | $results = $builder->get(); |
76 | - } else { |
|
76 | + }else { |
|
77 | 77 | $results = $model::all(); |
78 | 78 | } |
79 | 79 | |
80 | - return $results->map(function ($model) { |
|
80 | + return $results->map(function($model) { |
|
81 | 81 | return (new static($this->registration))->manage($model); |
82 | 82 | }); |
83 | 83 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function guard($verb): Manager |
147 | 147 | { |
148 | - if (! $this->can($verb)) { |
|
148 | + if (!$this->can($verb)) { |
|
149 | 149 | NotAllowedManagerRoute::notAllowedVerb($verb, $this); |
150 | 150 | } |
151 | 151 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $fields = $this->fields(); |
169 | 169 | |
170 | 170 | foreach ($this->assistants() as $assistant) { |
171 | - if (! method_exists($assistant, 'fields')) { |
|
171 | + if (!method_exists($assistant, 'fields')) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // Media fields are treated separately |
28 | 28 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
29 | - if (! isset($this->saveMethods['_files'])) { |
|
29 | + if (!isset($this->saveMethods['_files'])) { |
|
30 | 30 | $this->saveMethods['_files'] = ['field' => new Fields([$field]), 'method' => 'uploadMedia']; |
31 | 31 | continue; |
32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Custom set methods - default is the generic setField() method. |
39 | - $methodName = 'set'. ucfirst(Str::camel($field->key())) . 'Field'; |
|
39 | + $methodName = 'set'.ucfirst(Str::camel($field->key())).'Field'; |
|
40 | 40 | (method_exists($this, $methodName)) |
41 | 41 | ? $this->$methodName($field, $request) |
42 | 42 | : $this->setField($field, $request); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function detectCustomSaveMethods(Field $field): bool |
55 | 55 | { |
56 | - $saveMethodName = 'save'. ucfirst(Str::camel($field->key())) . 'Field'; |
|
56 | + $saveMethodName = 'save'.ucfirst(Str::camel($field->key())).'Field'; |
|
57 | 57 | |
58 | 58 | // Custom save method on assistant |
59 | 59 | foreach ($this->assistants() as $assistant) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // Make our media fields able to be translatable as well... |
97 | 97 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
98 | - throw new \Exception('Cannot process the ' . $field->key . ' media field. Currently no support for translatable media files. We should fix this!'); |
|
98 | + throw new \Exception('Cannot process the '.$field->key.' media field. Currently no support for translatable media files. We should fix this!'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Okay so this is a bit odd but since all translations are expected to be inside the trans |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->app->singleton(Settings::class, function ($app) { |
|
16 | + $this->app->singleton(Settings::class, function($app) { |
|
17 | 17 | return new Settings(); |
18 | 18 | }); |
19 | 19 | } |