@@ -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 | } |
@@ -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; |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $permission = 'update-page'; |
| 63 | 63 | |
| 64 | - if (in_array($verb, ['index','show'])) { |
|
| 64 | + if (in_array($verb, ['index', 'show'])) { |
|
| 65 | 65 | $permission = 'view-page'; |
| 66 | - } elseif (in_array($verb, ['create','store'])) { |
|
| 66 | + } elseif (in_array($verb, ['create', 'store'])) { |
|
| 67 | 67 | $permission = 'create-page'; |
| 68 | 68 | } elseif (in_array($verb, ['delete'])) { |
| 69 | 69 | $permission = 'delete-page'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 72 | + if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 73 | 73 | throw NotAllowedManagerRoute::notAllowedPermission($permission, $this); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function fieldArrangement($key = null): FieldArrangement |
| 131 | 131 | { |
| 132 | 132 | if ($key == 'create') { |
| 133 | - return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function ($field) { |
|
| 133 | + return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function($field) { |
|
| 134 | 134 | return in_array($field->key, ['title']); |
| 135 | 135 | })); |
| 136 | 136 | } |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | if ($this->model->id) { |
| 153 | 153 | return parent::details() |
| 154 | 154 | ->set('title', $this->model->title) |
| 155 | - ->set('intro', 'Aangepast ' . $this->model->updated_at->format('d/m/Y H:i')) |
|
| 156 | - ->set('context', '<span class="inline-s">' . $this->assistant('publish')->publicationStatusAsLabel() . '</span>'); |
|
| 155 | + ->set('intro', 'Aangepast '.$this->model->updated_at->format('d/m/Y H:i')) |
|
| 156 | + ->set('context', '<span class="inline-s">'.$this->assistant('publish')->publicationStatusAsLabel().'</span>'); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return parent::details(); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function saveFields(Request $request) |
| 163 | 163 | { |
| 164 | 164 | // Store the morph_key upon creation |
| 165 | - if (! $this->model->morph_key) { |
|
| 165 | + if (!$this->model->morph_key) { |
|
| 166 | 166 | $this->model->morph_key = $this->model->morphKey(); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if (is_array_empty($translation)) { |
| 208 | 208 | |
| 209 | 209 | // Nullify all values |
| 210 | - $trans[$locale] = array_map(function ($value) { |
|
| 210 | + $trans[$locale] = array_map(function($value) { |
|
| 211 | 211 | return null; |
| 212 | 212 | }, $translation); |
| 213 | 213 | 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, |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // Media fields are treated separately |
| 29 | 29 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
| 30 | - if (! isset($this->saveMethods['_files'])) { |
|
| 30 | + if (!isset($this->saveMethods['_files'])) { |
|
| 31 | 31 | $this->saveMethods['_files'] = ['field' => new Fields([$field]), 'method' => 'uploadMedia']; |
| 32 | 32 | continue; |
| 33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Custom set methods - default is the generic setField() method. |
| 40 | - $methodName = 'set'. ucfirst(Str::camel($field->key())) . 'Field'; |
|
| 40 | + $methodName = 'set'.ucfirst(Str::camel($field->key())).'Field'; |
|
| 41 | 41 | (method_exists($this, $methodName)) |
| 42 | 42 | ? $this->$methodName($field, $request) |
| 43 | 43 | : $this->setField($field, $request); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | protected function detectCustomSaveMethods(Manager $manager, Field $field): bool |
| 53 | 53 | { |
| 54 | - $saveMethodName = 'save'. ucfirst(Str::camel($field->key())) . 'Field'; |
|
| 54 | + $saveMethodName = 'save'.ucfirst(Str::camel($field->key())).'Field'; |
|
| 55 | 55 | |
| 56 | 56 | // Custom save method on assistant |
| 57 | 57 | foreach ($this->assistants() as $assistant) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // Make our media fields able to be translatable as well... |
| 95 | 95 | if ($field->ofType(FieldType::MEDIA, FieldType::DOCUMENT)) { |
| 96 | - throw new \Exception('Cannot process the ' . $field->key . ' media field. Currently no support for translatable media files. We should fix this!'); |
|
| 96 | + throw new \Exception('Cannot process the '.$field->key.' media field. Currently no support for translatable media files. We should fix this!'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Okay so this is a bit odd but since all translations are expected to be inside the trans |
@@ -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 | |