@@ -28,7 +28,7 @@ discard block |
||
| 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 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $with = array_map(function ($with) use ($path) { |
|
| 40 | + $with = array_map(function($with) use ($path) { |
|
| 41 | 41 | return $path ? "{$path}.{$with}" : $with; |
| 42 | 42 | }, $field->getWith() ?? []); |
| 43 | 43 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | $key = $this->instance->getKeyName(); |
| 204 | 204 | |
| 205 | - if (! $key) { |
|
| 205 | + if (!$key) { |
|
| 206 | 206 | return []; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function getFields(): Collection |
| 223 | 223 | { |
| 224 | - return collect($this->getKeyField())->merge($this->fields())->map(function (Field $field, string $key) { |
|
| 225 | - if (! $field->getAccessor()) { |
|
| 224 | + return collect($this->getKeyField())->merge($this->fields())->map(function(Field $field, string $key) { |
|
| 225 | + if (!$field->getAccessor()) { |
|
| 226 | 226 | $field->accessor($key); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function getFillableFields(): Collection |
| 242 | 242 | { |
| 243 | - return $this->getFields()->filter(function (Field $field) { |
|
| 243 | + return $this->getFields()->filter(function(Field $field) { |
|
| 244 | 244 | return $field->isFillable(); |
| 245 | 245 | }); |
| 246 | 246 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function getSortableFields(): Collection |
| 252 | 252 | { |
| 253 | - return $this->getFields()->filter(function (Field $field) { |
|
| 253 | + return $this->getFields()->filter(function(Field $field) { |
|
| 254 | 254 | return $field->isSortable(); |
| 255 | 255 | }); |
| 256 | 256 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function getSearchableFields(): Collection |
| 264 | 264 | { |
| 265 | - return $this->getFields()->filter(function (Field $field) { |
|
| 265 | + return $this->getFields()->filter(function(Field $field) { |
|
| 266 | 266 | return $field->isSearchable(); |
| 267 | 267 | }); |
| 268 | 268 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public function getSearchableRelationFields(): Collection |
| 276 | 276 | { |
| 277 | - return $this->getRelationFields()->filter(function (Field $field) { |
|
| 277 | + return $this->getRelationFields()->filter(function(Field $field) { |
|
| 278 | 278 | return $field->isSearchable(); |
| 279 | 279 | }); |
| 280 | 280 | } |
@@ -287,15 +287,15 @@ discard block |
||
| 287 | 287 | public function getLookupFields(): Collection |
| 288 | 288 | { |
| 289 | 289 | $fields = collect($this->getFields()) |
| 290 | - ->filter(function (Field $field) { |
|
| 290 | + ->filter(function(Field $field) { |
|
| 291 | 291 | return $field->isUnique(); |
| 292 | 292 | }); |
| 293 | 293 | |
| 294 | 294 | $relations = collect($this->getRelationFields()) |
| 295 | - ->filter(function ($field) { |
|
| 295 | + ->filter(function($field) { |
|
| 296 | 296 | return $field instanceof EloquentField; |
| 297 | 297 | }) |
| 298 | - ->map(function (EloquentField $field) { |
|
| 298 | + ->map(function(EloquentField $field) { |
|
| 299 | 299 | $lookupTypeName = $field->getName().'LookupType'; |
| 300 | 300 | |
| 301 | 301 | return $this->registry->field($lookupTypeName); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | return collect() |
| 305 | 305 | ->merge($fields) |
| 306 | 306 | ->merge($relations) |
| 307 | - ->map(function (Field $field) { |
|
| 307 | + ->map(function(Field $field) { |
|
| 308 | 308 | return $field->nullable(); |
| 309 | 309 | }); |
| 310 | 310 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | public function getLookupTypes(): Collection |
| 318 | 318 | { |
| 319 | - return $this->getLookupFields()->map(function (Field $field) { |
|
| 319 | + return $this->getLookupFields()->map(function(Field $field) { |
|
| 320 | 320 | return $field->getType(); |
| 321 | 321 | }); |
| 322 | 322 | } |
@@ -328,12 +328,12 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function getRelationFields(): Collection |
| 330 | 330 | { |
| 331 | - return collect($this->relations())->map(function (Field $field, string $key) { |
|
| 332 | - if (! $field->getAccessor()) { |
|
| 331 | + return collect($this->relations())->map(function(Field $field, string $key) { |
|
| 332 | + if (!$field->getAccessor()) { |
|
| 333 | 333 | $field->accessor($key); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if (! $field->getWith()) { |
|
| 336 | + if (!$field->getWith()) { |
|
| 337 | 337 | $field->with($field->getAccessor()); |
| 338 | 338 | } |
| 339 | 339 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | public function getFillableRelationFields(): Collection |
| 350 | 350 | { |
| 351 | - return $this->getRelationFields()->filter(function (Field $field) { |
|
| 351 | + return $this->getRelationFields()->filter(function(Field $field) { |
|
| 352 | 352 | return $field->isFillable(); |
| 353 | 353 | }); |
| 354 | 354 | } |
@@ -361,13 +361,13 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public function getRelations(): Collection |
| 363 | 363 | { |
| 364 | - return collect($this->relations())->map(function (Field $field, string $key) { |
|
| 365 | - if (! $field->getAccessor()) { |
|
| 364 | + return collect($this->relations())->map(function(Field $field, string $key) { |
|
| 365 | + if (!$field->getAccessor()) { |
|
| 366 | 366 | $field->accessor($key); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | return $field; |
| 370 | - })->map(function (Field $field) { |
|
| 370 | + })->map(function(Field $field) { |
|
| 371 | 371 | if ($field instanceof EloquentField) { |
| 372 | 372 | return $field->getRelation($this->getModel()); |
| 373 | 373 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | public function getFieldByKey(string $key): ?Field |
| 393 | 393 | { |
| 394 | 394 | return $this->getFields()->merge($this->getRelationFields()) |
| 395 | - ->first(function (Field $field, $fieldKey) use ($key) { |
|
| 395 | + ->first(function(Field $field, $fieldKey) use ($key) { |
|
| 396 | 396 | return $fieldKey === $key; |
| 397 | 397 | }); |
| 398 | 398 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | public function getConnections(): Collection |
| 406 | 406 | { |
| 407 | - return collect($this->getRelationFields())->map(function (Field $field, $key) { |
|
| 407 | + return collect($this->getRelationFields())->map(function(Field $field, $key) { |
|
| 408 | 408 | return $field->isList() ? Str::singular($key).'Ids' : $key.'Id'; |
| 409 | 409 | }); |
| 410 | 410 | } |