Passed
Pull Request — master (#124)
by Erik
05:08
created
src/Queries/Concerns/EagerLoadRelationships.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
         foreach ($fields as $key => $subFields) {
28 28
             $field = $schema->getFieldByKey($key);
29 29
 
30
-            $with = array_map(function ($with) use ($path) {
30
+            $with = array_map(function($with) use ($path) {
31 31
                 return $path ? "{$path}.{$with}" : $with;
32 32
             }, $field->getWith() ?? []);
33 33
 
34 34
             $query->with($with);
35 35
 
36
-            if ($field->isRelationship() && ! $field instanceof PolymorphicField) {
36
+            if ($field->isRelationship() && !$field instanceof PolymorphicField) {
37 37
                 $accessor = $field->getAccessor();
38 38
                 $related = $schema->getModel()->{$accessor}()->getRelated();
39 39
                 $relatedSchema = $this->registry->getSchemaForModel($related);
Please login to merge, or discard this patch.
src/Eloquent/ModelSchema.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.