@@ -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 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function findAll(): Collection |
73 | 73 | { |
74 | - return $this->model->published()->get()->map(function ($model) { |
|
74 | + return $this->model->published()->get()->map(function($model) { |
|
75 | 75 | return $this->managers->findByModel($model); |
76 | 76 | }); |
77 | 77 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function guard($verb): Assistant |
95 | 95 | { |
96 | - if (! $this->can($verb)) { |
|
96 | + if (!$this->can($verb)) { |
|
97 | 97 | NotAllowedManagerRoute::notAllowedVerb($verb, $this->manager); |
98 | 98 | } |
99 | 99 | |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | $class = $this->isPublished() ? 'text-success' : 'text-error'; |
113 | 113 | |
114 | - $statusAsLabel = '<span class="'. $class .'"><em>' . $label . '</em></span>'; |
|
114 | + $statusAsLabel = '<span class="'.$class.'"><em>'.$label.'</em></span>'; |
|
115 | 115 | |
116 | - if(!$plain && $this->hasPreviewUrl()) |
|
116 | + if (!$plain && $this->hasPreviewUrl()) |
|
117 | 117 | { |
118 | - $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'. $statusAsLabel .'</a>'; |
|
118 | + $statusAsLabel = '<a href="'.$this->previewUrl().'" target="_blank">'.$statusAsLabel.'</a>'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $statusAsLabel; |
@@ -125,9 +125,9 @@ |
||
125 | 125 | { |
126 | 126 | if ($this->isPublished()) { |
127 | 127 | return 'online'; |
128 | - }elseif ($this->isDraft()) { |
|
128 | + } elseif ($this->isDraft()) { |
|
129 | 129 | return 'offline'; |
130 | - }elseif ($this->manager->isAssistedBy('archive') && $this->manager->assistant('archive')->isArchived()) { |
|
130 | + } elseif ($this->manager->isAssistedBy('archive') && $this->manager->assistant('archive')->isArchived()) { |
|
131 | 131 | return 'gearchiveerd'; |
132 | 132 | } |
133 | 133 |
@@ -63,11 +63,11 @@ |
||
63 | 63 | |
64 | 64 | public static function managedModelKey(): string |
65 | 65 | { |
66 | - if(isset(static::$managedModelKey)){ |
|
66 | + if (isset(static::$managedModelKey)) { |
|
67 | 67 | return static::$managedModelKey; |
68 | 68 | } |
69 | 69 | |
70 | - throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.'); |
|
70 | + throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | public static function managedModelKey(): string |
82 | 82 | { |
83 | - if(isset(static::$managedModelKey)){ |
|
83 | + if (isset(static::$managedModelKey)) { |
|
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 ''; |
@@ -35,8 +35,8 @@ |
||
35 | 35 | |
36 | 36 | private function convertToCachableParameters(array $parameters) |
37 | 37 | { |
38 | - foreach($parameters as $key => $value) { |
|
39 | - if($value instanceof Model) $parameters[$key] = get_class($value) . '@' . $value->id; |
|
38 | + foreach ($parameters as $key => $value) { |
|
39 | + if ($value instanceof Model) $parameters[$key] = get_class($value).'@'.$value->id; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $parameters; |
@@ -36,7 +36,9 @@ |
||
36 | 36 | private function convertToCachableParameters(array $parameters) |
37 | 37 | { |
38 | 38 | foreach($parameters as $key => $value) { |
39 | - if($value instanceof Model) $parameters[$key] = get_class($value) . '@' . $value->id; |
|
39 | + if($value instanceof Model) { |
|
40 | + $parameters[$key] = get_class($value) . '@' . $value->id; |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | |
42 | 44 | return $parameters; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | public function setAttribute($key, $value) |
15 | 15 | { |
16 | - if($key == $this->translatableAttribute && is_array($value)) { |
|
16 | + if ($key == $this->translatableAttribute && is_array($value)) { |
|
17 | 17 | $value = json_encode($value); |
18 | 18 | } |
19 | 19 |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function name(string $name = null) |
53 | 53 | { |
54 | - if(!is_null($name)) { |
|
54 | + if (!is_null($name)) { |
|
55 | 55 | $this->values['name'] = $name; |
56 | 56 | |
57 | 57 | return $this; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $name = $this->name(); |
88 | 88 | |
89 | - if(strpos($name, ':locale')) { |
|
89 | + if (strpos($name, ':locale')) { |
|
90 | 90 | return preg_replace('#(:locale)#', $locale, $name); |
91 | 91 | } |
92 | 92 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | if (!in_array($name, ['label', 'key', 'description', 'column', 'name', 'prepend', 'append'])) { |
178 | - throw new \InvalidArgumentException('Cannot set value by ['. $name .'].'); |
|
178 | + throw new \InvalidArgumentException('Cannot set value by ['.$name.'].'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | $this->values[$name] = $arguments[0]; |