@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ->put('AND', $this->registry->field($this->registry->type($this->name()))->list()) |
54 | 54 | ->put('OR', $this->registry->field($this->registry->type($this->name()))->list()); |
55 | 55 | |
56 | - return $fields->map(function (Field $type) { |
|
56 | + return $fields->map(function(Field $type) { |
|
57 | 57 | return $type->nullable()->nullableItems(); |
58 | 58 | })->toArray(); |
59 | 59 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | { |
68 | 68 | $fields = $this->modelSchema->getFields(); |
69 | 69 | |
70 | - return $fields->reject(function (Field $field) { |
|
70 | + return $fields->reject(function(Field $field) { |
|
71 | 71 | return $field instanceof PolymorphicField; |
72 | - })->keys()->reduce(function (Collection $result, string $name) use ($fields) { |
|
72 | + })->keys()->reduce(function(Collection $result, string $name) use ($fields) { |
|
73 | 73 | $field = $fields->get($name); |
74 | 74 | |
75 | 75 | return $field->getType()->isLeafType() ? $result->merge($this->getFilters($name, $field)) : $result; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | { |
86 | 86 | $fields = $this->modelSchema->getRelationFields(); |
87 | 87 | |
88 | - return $fields->filter(function (Field $field) { |
|
88 | + return $fields->filter(function(Field $field) { |
|
89 | 89 | return $field instanceof EloquentField; |
90 | - })->keys()->reduce(function (Collection $result, string $name) use ($fields) { |
|
90 | + })->keys()->reduce(function(Collection $result, string $name) use ($fields) { |
|
91 | 91 | $field = $fields->get($name); |
92 | 92 | |
93 | 93 | return $result->put($name, $this->registry->field($this->registry->type($field->name().'Filter'))); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $fields = collect(); |
54 | 54 | |
55 | - $this->modelSchema->getFields()->each(function (Field $field, string $key) use ($fields) { |
|
55 | + $this->modelSchema->getFields()->each(function(Field $field, string $key) use ($fields) { |
|
56 | 56 | if ($field instanceof PolymorphicField) { |
57 | 57 | $fields = $fields->merge($this->getFieldsForPolymorphicField($key, $field)); |
58 | 58 | } else { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $field = $field->args([ |
128 | 128 | 'filter' => $this->registry->type($field->getName().'Filter')->nullable(), |
129 | - ])->resolve(function (Model $model, string $accessor, Arguments $args) { |
|
129 | + ])->resolve(function(Model $model, string $accessor, Arguments $args) { |
|
130 | 130 | $relation = $model->{$accessor}(); |
131 | 131 | |
132 | 132 | $result = $args->isEmpty() ? $model->{$accessor} : $this->getRelationQuery($relation, $args)->get(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ->args($field->getArgs()) |
143 | 143 | ->nullable($field->isNullable()) |
144 | 144 | ->viewPolicy($field->getViewPolicy()) |
145 | - ->resolve(function (Model $model, string $accessor, Arguments $args) { |
|
145 | + ->resolve(function(Model $model, string $accessor, Arguments $args) { |
|
146 | 146 | $relation = $model->{$accessor}(); |
147 | 147 | |
148 | 148 | $result = $args->isEmpty() ? $model->{$accessor} : $this->getRelationQuery($relation, $args)->get(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->accessor($field->getAccessor()) |
156 | 156 | ->nullable($field->isNullable()) |
157 | 157 | ->viewPolicy($field->getViewPolicy()) |
158 | - ->resolve(function (Model $model, string $accessor, Arguments $args) { |
|
158 | + ->resolve(function(Model $model, string $accessor, Arguments $args) { |
|
159 | 159 | $relation = $model->{$accessor}; |
160 | 160 | |
161 | 161 | $result = $args->isEmpty() ? $model->{$accessor} : $this->getRelationQuery($relation, $args); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ->accessor($field->getAccessor()) |
185 | 185 | ->nullable($field->isNullable()) |
186 | 186 | ->viewPolicy($field->getViewPolicy()) |
187 | - ->resolve(function (Model $model, string $accessor) { |
|
187 | + ->resolve(function(Model $model, string $accessor) { |
|
188 | 188 | $relation = $model->{$accessor}; |
189 | 189 | |
190 | 190 | return $relation ? $relation->getKey() : null; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $fields = collect(); |
206 | 206 | $pivot = $relation->getPivotClass(); |
207 | 207 | |
208 | - if (! $this->registry->hasSchemaForModel($pivot)) { |
|
208 | + if (!$this->registry->hasSchemaForModel($pivot)) { |
|
209 | 209 | return $fields; |
210 | 210 | } |
211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $related = $relation->getRelated(); |
216 | 216 | |
217 | - if (! $field->getInverse()) { |
|
217 | + if (!$field->getInverse()) { |
|
218 | 218 | $modelClassName = class_basename($this->model); |
219 | 219 | $relatedClassName = class_basename($related); |
220 | 220 | $guess = Utils::plural($modelClassName); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $accessor = $inverseRelation->getPivotAccessor(); |
236 | 236 | |
237 | 237 | $fields->put($pivotKey, $this->registry->field($modelSchema->typename()) |
238 | - ->resolve(function ($model) use ($accessor) { |
|
238 | + ->resolve(function($model) use ($accessor) { |
|
239 | 239 | return $model->{$accessor}; |
240 | 240 | }) |
241 | 241 | ); |
@@ -31,9 +31,9 @@ |
||
31 | 31 | $fields->put($name, $this->registry->field('Order')->nullable()); |
32 | 32 | } |
33 | 33 | |
34 | - $this->modelSchema->getRelationFields()->filter(function (Field $field) { |
|
34 | + $this->modelSchema->getRelationFields()->filter(function(Field $field) { |
|
35 | 35 | return $field instanceof EloquentField; |
36 | - })->each(function (EloquentField $field, $relation) use ($fields) { |
|
36 | + })->each(function(EloquentField $field, $relation) use ($fields) { |
|
37 | 37 | $fields->put($relation, $this->registry->field($field->name().'OrderBy')->nullable()); |
38 | 38 | }); |
39 | 39 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function fields(): array |
20 | 20 | { |
21 | - return $this->getModelSchemas()->reduce(function (array $fields, ModelSchema $modelSchema) { |
|
21 | + return $this->getModelSchemas()->reduce(function(array $fields, ModelSchema $modelSchema) { |
|
22 | 22 | $key = Utils::single($modelSchema->typename()); |
23 | 23 | $fields[$key] = $this->registry->field($this->registry->ID())->nullable(); |
24 | 24 |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | protected function getFillableFields(): Collection |
28 | 28 | { |
29 | 29 | return $this->modelSchema->getFillableFields() |
30 | - ->filter(function (Field $field) { |
|
31 | - return ! $field instanceof PolymorphicField && $field->setRegistry($this->registry)->getType()->isLeafType(); |
|
30 | + ->filter(function(Field $field) { |
|
31 | + return !$field instanceof PolymorphicField && $field->setRegistry($this->registry)->getType()->isLeafType(); |
|
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $relations = $this->modelSchema->getFillableRelationFields(); |
43 | 43 | |
44 | - return $relations->keys()->reduce(function (Collection $fields, $key) use ($relations) { |
|
44 | + return $relations->keys()->reduce(function(Collection $fields, $key) use ($relations) { |
|
45 | 45 | $field = $relations[$key]; |
46 | 46 | |
47 | 47 | if ($field instanceof EloquentField) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $pivot = $relation->getPivotClass(); |
136 | 136 | $relationName = $relation->getRelationName(); |
137 | 137 | |
138 | - if (! $this->registry->hasSchemaForModel($pivot)) { |
|
138 | + if (!$this->registry->hasSchemaForModel($pivot)) { |
|
139 | 139 | return collect(); |
140 | 140 | } |
141 | 141 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function types(): array |
20 | 20 | { |
21 | - return collect($this->modelSchemas)->map(function ($modelSchema) { |
|
21 | + return collect($this->modelSchemas)->map(function($modelSchema) { |
|
22 | 22 | return $modelSchema instanceof RootType |
23 | 23 | ? $modelSchema |
24 | 24 | : $this->registry->type($this->registry->getModelSchema($modelSchema)->typename()); |
@@ -75,7 +75,7 @@ |
||
75 | 75 | { |
76 | 76 | return [ |
77 | 77 | 'name' => $this->name(), |
78 | - 'types' => collect($this->types())->map(function (RootType $type) { |
|
78 | + 'types' => collect($this->types())->map(function(RootType $type) { |
|
79 | 79 | return $type->toNamedType(); |
80 | 80 | })->toArray(), |
81 | 81 | 'resolveType' => [$this, 'getTypeResolver'], |
@@ -35,7 +35,7 @@ |
||
35 | 35 | { |
36 | 36 | $fields = collect($this->fields()); |
37 | 37 | |
38 | - return $fields->map(function (Field $field) { |
|
38 | + return $fields->map(function(Field $field) { |
|
39 | 39 | return $field->toArray(); |
40 | 40 | }); |
41 | 41 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | $fields = collect($this->fields()); |
20 | 20 | |
21 | - return $fields->map(function (Field $field) { |
|
21 | + return $fields->map(function(Field $field) { |
|
22 | 22 | return $field->getType()->toType(); |
23 | 23 | }); |
24 | 24 | } |