@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | return array_merge( |
| 34 | 34 | parent::args(), |
| 35 | - $this->modelSchema->getLookupFields()->map(function (Field $field) { |
|
| 35 | + $this->modelSchema->getLookupFields()->map(function(Field $field) { |
|
| 36 | 36 | return $field->getType(); |
| 37 | 37 | })->toArray() |
| 38 | 38 | ); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $input = $args->input->toArray(); |
| 50 | 50 | $model = $this->findOrFail($args); |
| 51 | 51 | |
| 52 | - return DB::transaction(function () use ($input, $model) { |
|
| 52 | + return DB::transaction(function() use ($input, $model) { |
|
| 53 | 53 | $modelSchema = $this->registry->getSchemaForModel($model); |
| 54 | 54 | |
| 55 | 55 | return $modelSchema->updateIfAuthorized($input); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $this->modelSchema->getLookupFields() |
| 50 | - ->map(function (Field $field) { |
|
| 50 | + ->map(function(Field $field) { |
|
| 51 | 51 | return $field->getType(); |
| 52 | 52 | }) |
| 53 | 53 | ->merge(['input' => $type]) |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $input = $args->input->toArray(); |
| 77 | 77 | $model = $this->findOrFail($args); |
| 78 | 78 | |
| 79 | - return DB::transaction(function () use ($input, $model) { |
|
| 79 | + return DB::transaction(function() use ($input, $model) { |
|
| 80 | 80 | $modelSchema = $this->registry->getSchemaForModel($model); |
| 81 | 81 | |
| 82 | 82 | $relation = $this->getRelation($model); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $input = $args->input->toArray(); |
| 34 | 34 | |
| 35 | - return DB::transaction(function () use ($input) { |
|
| 35 | + return DB::transaction(function() use ($input) { |
|
| 36 | 36 | return $this->getModelSchema()->createIfAuthorized($input); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function args(): array |
| 43 | 43 | { |
| 44 | - return $this->modelSchema->getLookupFields()->map(function (Field $field) { |
|
| 44 | + return $this->modelSchema->getLookupFields()->map(function(Field $field) { |
|
| 45 | 45 | return $field->getType(); |
| 46 | 46 | })->toArray(); |
| 47 | 47 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $result = $this->find($args); |
| 65 | 65 | |
| 66 | - if (! $result) { |
|
| 66 | + if (!$result) { |
|
| 67 | 67 | throw (new ModelNotFoundException)->setModel(class_basename($this->model)); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $fields = collect($this->fields); |
| 31 | 31 | |
| 32 | - return $fields->map(function (RootField $field) { |
|
| 32 | + return $fields->map(function(RootField $field) { |
|
| 33 | 33 | return $field->toArray(); |
| 34 | 34 | }); |
| 35 | 35 | } |
@@ -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 (&$types) { |
|
| 232 | + })->each(function($relation) use (&$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 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $type = $this->registry->ID()->list(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - return $this->modelSchema->getLookupFields()->map(function (Field $field) { |
|
| 59 | + return $this->modelSchema->getLookupFields()->map(function(Field $field) { |
|
| 60 | 60 | return $field->getType(); |
| 61 | 61 | })->merge(['input' => $type])->toArray(); |
| 62 | 62 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $pivotAccessor = $relation->getPivotAccessor(); |
| 78 | 78 | $pivotSchema = $this->getPivotModelSchema(); |
| 79 | 79 | |
| 80 | - $input->map(function ($input) use ($pivotSchema, $relation, $pivotAccessor, $model) { |
|
| 80 | + $input->map(function($input) use ($pivotSchema, $relation, $pivotAccessor, $model) { |
|
| 81 | 81 | $key = $input[$model->getKeyName()] ?? $input; |
| 82 | 82 | $pivotWhere = $input[$pivotAccessor] ?? []; |
| 83 | 83 | |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | $query->wherePivot($relation->getRelatedPivotKeyName(), $key); |
| 96 | 96 | |
| 97 | 97 | return $query; |
| 98 | - })->map(function (Relations\BelongsToMany $query) use ($modelSchema) { |
|
| 99 | - $query->each(function (Model $related) use ($modelSchema) { |
|
| 98 | + })->map(function(Relations\BelongsToMany $query) use ($modelSchema) { |
|
| 99 | + $query->each(function(Model $related) use ($modelSchema) { |
|
| 100 | 100 | $modelSchema->authorizeToDetach($related); |
| 101 | 101 | }); |
| 102 | 102 | |
| 103 | 103 | return $query; |
| 104 | - })->each(function (Relations\BelongsToMany $query) { |
|
| 104 | + })->each(function(Relations\BelongsToMany $query) { |
|
| 105 | 105 | $query->detach(); |
| 106 | 106 | }); |
| 107 | 107 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | if (is_null($model)) { |
| 43 | 43 | $model = $this->rootNamespace().$this->argument('name'); |
| 44 | - } elseif (! Str::startsWith($model, [$this->rootNamespace(), '\\'])) { |
|
| 44 | + } elseif (!Str::startsWith($model, [$this->rootNamespace(), '\\'])) { |
|
| 45 | 45 | $model = $this->rootNamespace().$model; |
| 46 | 46 | } |
| 47 | 47 | |