@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return $this->indexPagination($builder); |
89 | 89 | } |
90 | 90 | |
91 | - return $builder->get()->map(function ($model) { |
|
91 | + return $builder->get()->map(function($model) { |
|
92 | 92 | return (new static($this->registration))->manage($model); |
93 | 93 | }); |
94 | 94 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $paginator = $builder->paginate($this->pageCount); |
118 | 118 | |
119 | - $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) { |
|
119 | + $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) { |
|
120 | 120 | return (new static($this->registration))->manage($model); |
121 | 121 | }); |
122 | 122 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | public function editFields(): Fields |
234 | 234 | { |
235 | - return $this->fieldsWithAssistantFields()->map(function(Field $field){ |
|
235 | + return $this->fieldsWithAssistantFields()->map(function(Field $field) { |
|
236 | 236 | return $field->model($this->model); |
237 | 237 | }); |
238 | 238 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | static::$bootedTraitMethods[$baseMethod] = []; |
326 | 326 | |
327 | 327 | foreach (class_uses_recursive($class) as $trait) { |
328 | - $method = class_basename($trait) . ucfirst($baseMethod); |
|
328 | + $method = class_basename($trait).ucfirst($baseMethod); |
|
329 | 329 | |
330 | 330 | if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) { |
331 | 331 | static::$bootedTraitMethods[$baseMethod][] = lcfirst($method); |
@@ -51,8 +51,8 @@ |
||
51 | 51 | |
52 | 52 | public function editFields(): Fields |
53 | 53 | { |
54 | - return $this->fields()->map(function(Field $field){ |
|
55 | - return $field->valueResolver(function($model = null, $locale = null, $field){ |
|
54 | + return $this->fields()->map(function(Field $field) { |
|
55 | + return $field->valueResolver(function($model = null, $locale = null, $field) { |
|
56 | 56 | return $this->settings->get($field->getKey(), $locale); |
57 | 57 | }); |
58 | 58 | }); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | public function tagged($tag): bool |
10 | 10 | { |
11 | - $tags = (array) $tag; |
|
11 | + $tags = (array)$tag; |
|
12 | 12 | |
13 | 13 | return count(array_intersect($this->tags, $tags)) > 0; |
14 | 14 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $this->pageBuilderField(), |
85 | 85 | InputField::make('title')->translatable($this->model->availableLocales()) |
86 | 86 | ->validation('required-fallback-locale|max:200', [], [ |
87 | - 'trans.' . config('app.fallback_locale', 'nl') . '.title' => 'title', |
|
87 | + 'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title', |
|
88 | 88 | ]) |
89 | - ->label('De titel van je ' . $this->model->labelSingular ?? 'pagina') |
|
89 | + ->label('De titel van je '.$this->model->labelSingular ?? 'pagina') |
|
90 | 90 | ->description('Dit is de titel die zal worden getoond in de overzichten en modules.') |
91 | 91 | ->tag('general'), |
92 | 92 | InputField::make('seo_title') |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | if (is_array_empty($translation)) { |
207 | 207 | |
208 | 208 | // Nullify all values |
209 | - $trans[$locale] = array_map(function ($value) { |
|
209 | + $trans[$locale] = array_map(function($value) { |
|
210 | 210 | return null; |
211 | 211 | }, $translation); |
212 | 212 | continue; |
@@ -23,9 +23,9 @@ |
||
23 | 23 | |
24 | 24 | $field = $manager->fields()[($reference->hasFragmentKey() ? $reference->getFragmentKey() : $reference->getFieldKey())]; |
25 | 25 | |
26 | - if($reference->hasFragmentKey()) { |
|
27 | - if(!$field instanceof FragmentField) { |
|
28 | - throw new \RuntimeException('Field ' . $field->getKey() . ' was expected to be a fragmentfield but its not.'); |
|
26 | + if ($reference->hasFragmentKey()) { |
|
27 | + if (!$field instanceof FragmentField) { |
|
28 | + throw new \RuntimeException('Field '.$field->getKey().' was expected to be a fragmentfield but its not.'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $firstFragment = $field->getFragments()[0]; |
@@ -21,19 +21,19 @@ |
||
21 | 21 | { |
22 | 22 | return (new static(new FieldType(FieldType::FILE), $key)) |
23 | 23 | ->locales([config('app.fallback_locale', 'nl')]) |
24 | - ->valueResolver(function($model = null, $locale = null, FileField $field){ |
|
24 | + ->valueResolver(function($model = null, $locale = null, FileField $field) { |
|
25 | 25 | return $field->getMedia($model, $locale); |
26 | 26 | }); |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
30 | 30 | { |
31 | - if(!$model) return []; |
|
31 | + if (!$model) return []; |
|
32 | 32 | |
33 | 33 | $files = []; |
34 | 34 | $locale = $locale ?? app()->getLocale(); |
35 | 35 | |
36 | - $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function ($asset) use ($locale) { |
|
36 | + $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function($asset) use ($locale) { |
|
37 | 37 | return $asset->pivot->locale == $locale; |
38 | 38 | })->sortBy('pivot.order'); |
39 | 39 |
@@ -28,7 +28,9 @@ |
||
28 | 28 | |
29 | 29 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
30 | 30 | { |
31 | - if(!$model) return []; |
|
31 | + if(!$model) { |
|
32 | + return []; |
|
33 | + } |
|
32 | 34 | |
33 | 35 | $files = []; |
34 | 36 | $locale = $locale ?? app()->getLocale(); |
@@ -6,19 +6,19 @@ |
||
6 | 6 | |
7 | 7 | class FieldType |
8 | 8 | { |
9 | - const INPUT = 'input'; // oneliner text (input) |
|
10 | - const TEXT = 'text'; // Plain text (textarea) |
|
9 | + const INPUT = 'input'; // oneliner text (input) |
|
10 | + const TEXT = 'text'; // Plain text (textarea) |
|
11 | 11 | const NUMBER = 'number'; // number |
12 | 12 | const RANGE = 'range'; // range slider |
13 | - const DATE = 'date'; // Timestamp input |
|
14 | - const PHONENUMBER = 'phonenumber'; // Timestamp input |
|
15 | - const HTML = 'html'; // Html text (wysiwyg) |
|
16 | - const SELECT = 'select'; // Select options |
|
17 | - const FILE = 'file'; // regular file |
|
18 | - const IMAGE = 'image'; // image (slim uploader) |
|
19 | - const RADIO = 'radio'; // radio select |
|
20 | - const CHECKBOX = 'checkbox'; // checkbox select |
|
21 | - const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
13 | + const DATE = 'date'; // Timestamp input |
|
14 | + const PHONENUMBER = 'phonenumber'; // Timestamp input |
|
15 | + const HTML = 'html'; // Html text (wysiwyg) |
|
16 | + const SELECT = 'select'; // Select options |
|
17 | + const FILE = 'file'; // regular file |
|
18 | + const IMAGE = 'image'; // image (slim uploader) |
|
19 | + const RADIO = 'radio'; // radio select |
|
20 | + const CHECKBOX = 'checkbox'; // checkbox select |
|
21 | + const PAGEBUILDER = 'pagebuilder'; // the most special field there is... |
|
22 | 22 | const FRAGMENT = 'fragment'; |
23 | 23 | |
24 | 24 | /** @var string */ |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | */ |
264 | 264 | private function defaultEloquentValueResolver(): \Closure |
265 | 265 | { |
266 | - return function (Model $model = null, $locale = null) { |
|
266 | + return function(Model $model = null, $locale = null) { |
|
267 | 267 | |
268 | - if($this->value) return $this->value; |
|
268 | + if ($this->value) return $this->value; |
|
269 | 269 | |
270 | 270 | if (!$model) { |
271 | 271 | return $this->default; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | return $this->isLocalized() |
421 | 421 | ? 'chief::back._formgroups.fieldgroup_translatable' |
422 | - : 'chief::back._fields.' . $this->type->get(); |
|
422 | + : 'chief::back._fields.'.$this->type->get(); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | public function viewData(array $viewData = []): Field |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | 'model' => $this->getModel(), |
436 | 436 | 'field' => $this, |
437 | 437 | 'key' => $this->getKey(), |
438 | - ],$this->viewData); |
|
438 | + ], $this->viewData); |
|
439 | 439 | } |
440 | 440 | } |
@@ -265,7 +265,9 @@ |
||
265 | 265 | { |
266 | 266 | return function (Model $model = null, $locale = null) { |
267 | 267 | |
268 | - if($this->value) return $this->value; |
|
268 | + if($this->value) { |
|
269 | + return $this->value; |
|
270 | + } |
|
269 | 271 | |
270 | 272 | if (!$model) { |
271 | 273 | return $this->default; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | return (new static(new FieldType(FieldType::IMAGE), $key)) |
22 | 22 | ->locales([config('app.fallback_locale', 'nl')]) |
23 | - ->valueResolver(function($model = null, $locale = null, ImageField $field){ |
|
23 | + ->valueResolver(function($model = null, $locale = null, ImageField $field) { |
|
24 | 24 | return $field->getMedia($model, $locale); |
25 | 25 | }); |
26 | 26 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
34 | 34 | { |
35 | - if(!$model) return []; |
|
35 | + if (!$model) return []; |
|
36 | 36 | |
37 | 37 | $images = []; |
38 | 38 | $locale = $locale ?? app()->getLocale(); |
39 | 39 | |
40 | - $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function ($asset) use ($locale) { |
|
40 | + $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function($asset) use ($locale) { |
|
41 | 41 | return $asset->pivot->locale == $locale; |
42 | 42 | })->sortBy('pivot.order'); |
43 | 43 |
@@ -32,7 +32,9 @@ |
||
32 | 32 | |
33 | 33 | public function getMedia(HasAsset $model = null, ?string $locale = null) |
34 | 34 | { |
35 | - if(!$model) return []; |
|
35 | + if(!$model) { |
|
36 | + return []; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | $images = []; |
38 | 40 | $locale = $locale ?? app()->getLocale(); |