@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | $types = $types->merge($this->getPivotModelTypes($schema)); |
199 | 199 | } else { |
200 | 200 | $types->push(new Types\EntityType($this->registry, $schema)) |
201 | - ->push(new Types\EntityLookupType($this->registry, $schema)) |
|
202 | - ->push(new Types\CollectionFilterType($this->registry, $schema)) |
|
203 | - ->push(new Types\CollectionOrderByType($this->registry, $schema)); |
|
201 | + ->push(new Types\EntityLookupType($this->registry, $schema)) |
|
202 | + ->push(new Types\CollectionFilterType($this->registry, $schema)) |
|
203 | + ->push(new Types\CollectionOrderByType($this->registry, $schema)); |
|
204 | 204 | |
205 | 205 | if ($schema->isSearchable()) { |
206 | 206 | $types->push(new Types\CollectionSearchType($this->registry, $schema)); |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | |
209 | 209 | if ($schema->isIndexable()) { |
210 | 210 | $types->push(new Types\EntityCollectionType($this->registry, $schema)) |
211 | - ->push(new Types\CollectionRootSearchType($this->registry, $schema)); |
|
211 | + ->push(new Types\CollectionRootSearchType($this->registry, $schema)); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | if ($schema->isMutable()) { |
215 | 215 | $types->push(new Types\CreateInputType($this->registry, $schema)) |
216 | - ->push(new Types\UpdateInputType($this->registry, $schema)); |
|
216 | + ->push(new Types\UpdateInputType($this->registry, $schema)); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | protected function getModelTypes(): Collection |
193 | 193 | { |
194 | - return $this->getModels()->reduce(function (Collection $types, string $class) { |
|
194 | + return $this->getModels()->reduce(function(Collection $types, string $class) { |
|
195 | 195 | $schema = $this->registry->getModelSchema($class); |
196 | 196 | |
197 | 197 | if ($schema->getModel() instanceof Pivot) { |
@@ -218,26 +218,26 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | // Filter through the regular fields and get the polymorphic types. |
221 | - $schema->getFields()->filter(function ($field) { |
|
221 | + $schema->getFields()->filter(function($field) { |
|
222 | 222 | return $field instanceof PolymorphicField; |
223 | - })->each(function ($field, $key) use ($schema, &$types) { |
|
223 | + })->each(function($field, $key) use ($schema, &$types) { |
|
224 | 224 | $types = $types->merge($this->getPolymorphicFieldTypes($schema, $key, $field)); |
225 | 225 | }); |
226 | 226 | |
227 | 227 | // Filter through the relations of the model and get the |
228 | 228 | // belongsToMany relations and get the pivot input types |
229 | 229 | // for that relation. |
230 | - $schema->getRelations()->filter(function ($relation) { |
|
230 | + $schema->getRelations()->filter(function($relation) { |
|
231 | 231 | return $relation instanceof BelongsToMany; |
232 | - })->each(function ($relation) use ($schema, &$types) { |
|
232 | + })->each(function($relation) use ($schema, &$types) { |
|
233 | 233 | $types = $types->merge($this->getPivotInputTypes($relation)); |
234 | 234 | }); |
235 | 235 | |
236 | 236 | // Filter through the relation fields and get the the |
237 | 237 | // polymorphic types for the relations. |
238 | - $schema->getRelationFields()->filter(function ($field) { |
|
238 | + $schema->getRelationFields()->filter(function($field) { |
|
239 | 239 | return $field instanceof PolymorphicField; |
240 | - })->each(function ($field, $key) use ($schema, &$types) { |
|
240 | + })->each(function($field, $key) use ($schema, &$types) { |
|
241 | 241 | $types = $types->merge($this->getPolymorphicRelationshipTypes($schema, $key, $field)); |
242 | 242 | }); |
243 | 243 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | foreach ($this->getModels() as $modelSchema) { |
366 | 366 | $modelSchema = $this->registry->getModelSchema($modelSchema); |
367 | 367 | |
368 | - if (! $modelSchema->getModel() instanceof Pivot) { |
|
368 | + if (!$modelSchema->getModel() instanceof Pivot) { |
|
369 | 369 | $entityQuery = new SingleEntityQuery($this->registry, $modelSchema); |
370 | 370 | $queries->put($entityQuery->getName(), $entityQuery); |
371 | 371 | |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | foreach ($this->getModels() as $class) { |
411 | 411 | $modelSchema = $this->registry->getModelSchema($class); |
412 | 412 | |
413 | - $pivotRelations = $modelSchema->getRelations()->filter(function ($relation) { |
|
413 | + $pivotRelations = $modelSchema->getRelations()->filter(function($relation) { |
|
414 | 414 | return $relation instanceof BelongsToMany; |
415 | 415 | }); |
416 | 416 | |
417 | - if ($modelSchema->isMutable() && ! $modelSchema->getModel() instanceof Pivot) { |
|
417 | + if ($modelSchema->isMutable() && !$modelSchema->getModel() instanceof Pivot) { |
|
418 | 418 | $createMutation = new CreateMutation($this->registry, $modelSchema); |
419 | 419 | $mutations->put($createMutation->getName(), $createMutation); |
420 | 420 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $config->setDirectives(array_merge(Directive::getInternalDirectives(), $this->directives())); |
516 | 516 | |
517 | 517 | // Set the type loader |
518 | - $config->setTypeLoader(function ($name) use ($query, $mutation) { |
|
518 | + $config->setTypeLoader(function($name) use ($query, $mutation) { |
|
519 | 519 | if ($name === $query->name) { |
520 | 520 | return $query; |
521 | 521 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function getArgs(): array |
130 | 130 | { |
131 | - return collect($this->args())->map(function (RootType $type) { |
|
131 | + return collect($this->args())->map(function(RootType $type) { |
|
132 | 132 | return $type->toType(); |
133 | 133 | })->toArray(); |
134 | 134 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | private function getResolver() |
182 | 182 | { |
183 | - if (! method_exists($this, 'resolve')) { |
|
183 | + if (!method_exists($this, 'resolve')) { |
|
184 | 184 | return null; |
185 | 185 | } |
186 | 186 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function abstractResolver($root, array $args, $context, ResolveInfo $info) |
198 | 198 | { |
199 | - if (! method_exists($this, 'resolve')) { |
|
199 | + if (!method_exists($this, 'resolve')) { |
|
200 | 200 | return null; |
201 | 201 | } |
202 | 202 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | try { |
219 | 219 | $result = $this->authorize($args); |
220 | 220 | |
221 | - if (! $result instanceof Response) { |
|
221 | + if (!$result instanceof Response) { |
|
222 | 222 | $result = $result ? Response::allow() : Response::deny(); |
223 | 223 | } |
224 | 224 | } catch (AuthorizationException $exception) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | // We wrap the query in a closure to make sure it |
31 | 31 | // does not clash with other (scoped) queries that are on the builder. |
32 | - return $query->where(function ($query) use ($args) { |
|
32 | + return $query->where(function($query) use ($args) { |
|
33 | 33 | return $this->applyFiltersRecursively($query, $args); |
34 | 34 | }); |
35 | 35 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | { |
47 | 47 | foreach ($args as $filter => $value) { |
48 | 48 | if ($filter === 'AND' || $filter === 'OR') { |
49 | - $query->where(function ($query) use ($value, $filter) { |
|
49 | + $query->where(function($query) use ($value, $filter) { |
|
50 | 50 | foreach ($value as $set) { |
51 | - if (! empty($set)) { |
|
51 | + if (!empty($set)) { |
|
52 | 52 | $this->applyFiltersRecursively($query, $set, $filter); |
53 | 53 | } |
54 | 54 | } |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | $operator = '>='; |
87 | 87 | $type = $type ?: 'and'; |
88 | 88 | |
89 | - if (! $args || $args->isEmpty()) { |
|
89 | + if (!$args || $args->isEmpty()) { |
|
90 | 90 | return $query->doesntHave($relation, $type); |
91 | 91 | } |
92 | 92 | |
93 | - return $query->has($relation, $operator, $count, $type, function ($subQuery) use ($args) { |
|
93 | + return $query->has($relation, $operator, $count, $type, function($subQuery) use ($args) { |
|
94 | 94 | return $this->applyFiltersRecursively($subQuery, $args); |
95 | 95 | }); |
96 | 96 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function executeQuery($input, $schema = null): ExecutionResult |
36 | 36 | { |
37 | - if (! $schema) { |
|
37 | + if (!$schema) { |
|
38 | 38 | $schema = $this->schema(); |
39 | 39 | } elseif ($schema instanceof BakerySchema) { |
40 | 40 | $schema = $schema->toGraphQLSchema(); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public function graphiql(Request $request, Bakery $bakery) |
62 | 62 | { |
63 | - if (! app()->isLocal()) { |
|
63 | + if (!app()->isLocal()) { |
|
64 | 64 | abort(404); |
65 | 65 | } |
66 | 66 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | ->middleware(config('bakery.middleware', [])) |
8 | 8 | ->as('bakery.') |
9 | 9 | ->prefix(config('bakery.path')) |
10 | - ->group(function () { |
|
10 | + ->group(function() { |
|
11 | 11 | $controller = config('bakery.controller', 'BakeryController@graphql'); |
12 | 12 | |
13 | 13 | Route::get('/', $controller)->name('graphql'); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | { |
93 | 93 | foreach ($args as $key => $value) { |
94 | 94 | if ($value instanceof Arguments) { |
95 | - $query->whereHas($key, function (Builder $query) use ($value) { |
|
95 | + $query->whereHas($key, function(Builder $query) use ($value) { |
|
96 | 96 | $this->queryByArgs($query, $value); |
97 | 97 | }); |
98 | 98 | } else { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | protected function getRelationFieldByKey(string $key, ModelSchema $schema): Field |
50 | 50 | { |
51 | - return $schema->getRelationFields()->first(function (Field $field, $relation) use ($key) { |
|
51 | + return $schema->getRelationFields()->first(function(Field $field, $relation) use ($key) { |
|
52 | 52 | return $relation === $key; |
53 | 53 | }); |
54 | 54 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $args->put('search', $this->registry->type($this->modelSchema->typename().'RootSearch')->nullable()); |
67 | 67 | } |
68 | 68 | |
69 | - if (! empty($this->modelSchema->getFields())) { |
|
69 | + if (!empty($this->modelSchema->getFields())) { |
|
70 | 70 | $args->put('orderBy', $this->registry->type($this->modelSchema->typename().'OrderBy')->nullable()); |
71 | 71 | } |
72 | 72 |