@@ -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 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $key = $this->instance->getKeyName(); |
| 196 | 196 | |
| 197 | - if (! $key) { |
|
| 197 | + if (!$key) { |
|
| 198 | 198 | return []; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function getFields(): Collection |
| 215 | 215 | { |
| 216 | - return collect($this->getKeyField())->merge($this->fields())->map(function (Field $field, string $key) { |
|
| 217 | - if (! $field->getAccessor()) { |
|
| 216 | + return collect($this->getKeyField())->merge($this->fields())->map(function(Field $field, string $key) { |
|
| 217 | + if (!$field->getAccessor()) { |
|
| 218 | 218 | $field->accessor($key); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function getFillableFields(): Collection |
| 234 | 234 | { |
| 235 | - return $this->getFields()->filter(function (Field $field) { |
|
| 235 | + return $this->getFields()->filter(function(Field $field) { |
|
| 236 | 236 | return $field->isFillable(); |
| 237 | 237 | }); |
| 238 | 238 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function getSearchableFields(): Collection |
| 246 | 246 | { |
| 247 | - return $this->getFields()->filter(function (Field $field) { |
|
| 247 | + return $this->getFields()->filter(function(Field $field) { |
|
| 248 | 248 | return $field->isSearchable(); |
| 249 | 249 | }); |
| 250 | 250 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function getSearchableRelationFields(): Collection |
| 258 | 258 | { |
| 259 | - return $this->getRelationFields()->filter(function (Field $field) { |
|
| 259 | + return $this->getRelationFields()->filter(function(Field $field) { |
|
| 260 | 260 | return $field->isSearchable(); |
| 261 | 261 | }); |
| 262 | 262 | } |
@@ -269,15 +269,15 @@ discard block |
||
| 269 | 269 | public function getLookupFields(): Collection |
| 270 | 270 | { |
| 271 | 271 | $fields = collect($this->getFields()) |
| 272 | - ->filter(function (Field $field) { |
|
| 272 | + ->filter(function(Field $field) { |
|
| 273 | 273 | return $field->isUnique(); |
| 274 | 274 | }); |
| 275 | 275 | |
| 276 | 276 | $relations = collect($this->getRelationFields()) |
| 277 | - ->filter(function ($field) { |
|
| 277 | + ->filter(function($field) { |
|
| 278 | 278 | return $field instanceof EloquentField; |
| 279 | 279 | }) |
| 280 | - ->map(function (EloquentField $field) { |
|
| 280 | + ->map(function(EloquentField $field) { |
|
| 281 | 281 | $lookupTypeName = $field->getName().'LookupType'; |
| 282 | 282 | |
| 283 | 283 | return $this->registry->field($lookupTypeName); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | return collect() |
| 287 | 287 | ->merge($fields) |
| 288 | 288 | ->merge($relations) |
| 289 | - ->map(function (Field $field) { |
|
| 289 | + ->map(function(Field $field) { |
|
| 290 | 290 | return $field->nullable(); |
| 291 | 291 | }); |
| 292 | 292 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | public function getLookupTypes(): Collection |
| 300 | 300 | { |
| 301 | - return $this->getLookupFields()->map(function (Field $field) { |
|
| 301 | + return $this->getLookupFields()->map(function(Field $field) { |
|
| 302 | 302 | return $field->getType(); |
| 303 | 303 | }); |
| 304 | 304 | } |
@@ -310,12 +310,12 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function getRelationFields(): Collection |
| 312 | 312 | { |
| 313 | - return collect($this->relations())->map(function (Field $field, string $key) { |
|
| 314 | - if (! $field->getAccessor()) { |
|
| 313 | + return collect($this->relations())->map(function(Field $field, string $key) { |
|
| 314 | + if (!$field->getAccessor()) { |
|
| 315 | 315 | $field->accessor($key); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if (! $field->getWith()) { |
|
| 318 | + if (!$field->getWith()) { |
|
| 319 | 319 | $field->with($field->getAccessor()); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function getFillableRelationFields(): Collection |
| 332 | 332 | { |
| 333 | - return $this->getRelationFields()->filter(function (Field $field) { |
|
| 333 | + return $this->getRelationFields()->filter(function(Field $field) { |
|
| 334 | 334 | return $field->isFillable(); |
| 335 | 335 | }); |
| 336 | 336 | } |
@@ -343,13 +343,13 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | public function getRelations(): Collection |
| 345 | 345 | { |
| 346 | - return collect($this->relations())->map(function (Field $field, string $key) { |
|
| 347 | - if (! $field->getAccessor()) { |
|
| 346 | + return collect($this->relations())->map(function(Field $field, string $key) { |
|
| 347 | + if (!$field->getAccessor()) { |
|
| 348 | 348 | $field->accessor($key); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | return $field; |
| 352 | - })->map(function (Field $field) { |
|
| 352 | + })->map(function(Field $field) { |
|
| 353 | 353 | $accessor = $field->getAccessor(); |
| 354 | 354 | |
| 355 | 355 | Utils::invariant( |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | public function getFieldByKey(string $key): ?Field |
| 371 | 371 | { |
| 372 | 372 | return $this->getFields()->merge($this->getRelationFields()) |
| 373 | - ->first(function (Field $field, $fieldKey) use ($key) { |
|
| 373 | + ->first(function(Field $field, $fieldKey) use ($key) { |
|
| 374 | 374 | return $fieldKey === $key; |
| 375 | 375 | }); |
| 376 | 376 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public function getConnections(): Collection |
| 384 | 384 | { |
| 385 | - return collect($this->getRelationFields())->map(function (Field $field, $key) { |
|
| 385 | + return collect($this->getRelationFields())->map(function(Field $field, $key) { |
|
| 386 | 386 | return $field->isList() ? Str::singular($key).'Ids' : $key.'Id'; |
| 387 | 387 | }); |
| 388 | 388 | } |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | $field = $schema->getFieldByKey($key); |
| 29 | 29 | |
| 30 | 30 | // Skip if this is not a defined field. |
| 31 | - if (! $field) { |
|
| 31 | + if (!$field) { |
|
| 32 | 32 | continue; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $with = array_map(function ($with) use ($path) { |
|
| 35 | + $with = array_map(function($with) use ($path) { |
|
| 36 | 36 | return $path ? "{$path}.{$with}" : $with; |
| 37 | 37 | }, $field->getWith() ?? []); |
| 38 | 38 | |
| 39 | 39 | $query->with($with); |
| 40 | 40 | |
| 41 | - if ($field->isRelationship() && ! $field instanceof PolymorphicField) { |
|
| 41 | + if ($field->isRelationship() && !$field instanceof PolymorphicField) { |
|
| 42 | 42 | $accessor = $field->getAccessor(); |
| 43 | 43 | $related = $schema->getModel()->{$accessor}()->getRelated(); |
| 44 | 44 | $relatedSchema = $this->registry->getSchemaForModel($related); |