@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $args = new Arguments($args); |
515 | 515 | |
516 | 516 | if (isset($this->viewPolicy)) { |
517 | - if (! $this->authorizeToRead($root, $info->fieldName)) { |
|
517 | + if (!$this->authorizeToRead($root, $info->fieldName)) { |
|
518 | 518 | return null; |
519 | 519 | } |
520 | 520 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $policy = $this->viewPolicy; |
556 | 556 | |
557 | 557 | // Check if there is a policy. |
558 | - if (! $policy) { |
|
558 | + if (!$policy) { |
|
559 | 559 | return true; |
560 | 560 | } |
561 | 561 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $policy = $this->storePolicy; |
607 | 607 | |
608 | 608 | // Check if there is a policy. |
609 | - if (! $policy) { |
|
609 | + if (!$policy) { |
|
610 | 610 | return true; |
611 | 611 | } |
612 | 612 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | { |
633 | 633 | return [ |
634 | 634 | 'type' => $this->getType()->toType(), |
635 | - 'args' => collect($this->getArgs())->map(function (RootType $type) { |
|
635 | + 'args' => collect($this->getArgs())->map(function(RootType $type) { |
|
636 | 636 | return $type->toType(); |
637 | 637 | })->toArray(), |
638 | 638 | 'resolve' => [$this, 'resolveField'], |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public static function bootBakeryTransactionalAware() |
27 | 27 | { |
28 | - Event::listen('eloquent.booted: '.static::class, function (Model $model) { |
|
28 | + Event::listen('eloquent.booted: '.static::class, function(Model $model) { |
|
29 | 29 | $model->addObservableEvents(['persisting', 'persisted']); |
30 | 30 | }); |
31 | 31 | } |
@@ -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,8 +310,8 @@ 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 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function getFillableRelationFields(): Collection |
328 | 328 | { |
329 | - return $this->getRelationFields()->filter(function (Field $field) { |
|
329 | + return $this->getRelationFields()->filter(function(Field $field) { |
|
330 | 330 | return $field->isFillable(); |
331 | 331 | }); |
332 | 332 | } |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | */ |
340 | 340 | public function getRelations(): Collection |
341 | 341 | { |
342 | - return collect($this->relations())->map(function (Field $field, string $key) { |
|
343 | - if (! $field->getAccessor()) { |
|
342 | + return collect($this->relations())->map(function(Field $field, string $key) { |
|
343 | + if (!$field->getAccessor()) { |
|
344 | 344 | $field->accessor($key); |
345 | 345 | } |
346 | 346 | |
347 | 347 | return $field; |
348 | - })->map(function (Field $field) { |
|
348 | + })->map(function(Field $field) { |
|
349 | 349 | $accessor = $field->getAccessor(); |
350 | 350 | |
351 | 351 | Utils::invariant( |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | public function getFieldByKey(string $key): ?Field |
367 | 367 | { |
368 | 368 | return $this->getFields()->merge($this->getRelationFields()) |
369 | - ->first(function (Field $field, $fieldKey) use ($key) { |
|
369 | + ->first(function(Field $field, $fieldKey) use ($key) { |
|
370 | 370 | return $fieldKey === $key; |
371 | 371 | }); |
372 | 372 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function getConnections(): Collection |
380 | 380 | { |
381 | - return collect($this->getRelationFields())->map(function (Field $field, $key) { |
|
381 | + return collect($this->getRelationFields())->map(function(Field $field, $key) { |
|
382 | 382 | return $field->isList() ? Str::singular($key).'Ids' : $key.'Id'; |
383 | 383 | }); |
384 | 384 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function create(array $input = []): Model |
62 | 62 | { |
63 | - return $this->transaction(function () use ($input) { |
|
63 | + return $this->transaction(function() use ($input) { |
|
64 | 64 | $this->make($input); |
65 | 65 | $this->save(); |
66 | 66 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function createIfAuthorized(array $input = []): Model |
78 | 78 | { |
79 | - return $this->transaction(function () use ($input) { |
|
79 | + return $this->transaction(function() use ($input) { |
|
80 | 80 | $this->create($input); |
81 | 81 | $this->authorizeToCreate(); |
82 | 82 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function update(array $input = []): Model |
107 | 107 | { |
108 | - return $this->transaction(function () use ($input) { |
|
108 | + return $this->transaction(function() use ($input) { |
|
109 | 109 | $this->fill($input); |
110 | 110 | $this->save(); |
111 | 111 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function authorizeToCreate(): void |
19 | 19 | { |
20 | - if (! static::authorizedToCreate()) { |
|
20 | + if (!static::authorizedToCreate()) { |
|
21 | 21 | throw new AuthorizationException("Not allowed to perform create on {$this->getModelClass()}"); |
22 | 22 | } |
23 | 23 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function authorize(string $ability, $arguments = []): void |
167 | 167 | { |
168 | - if (! $this->authorized($ability, $arguments)) { |
|
168 | + if (!$this->authorized($ability, $arguments)) { |
|
169 | 169 | throw new AuthorizationException("Not allowed to perform {$ability} on {$this->getModelClass()}"); |
170 | 170 | } |
171 | 171 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $relationType = $this->getRelationTypeName($relation); |
62 | 62 | $method = "fill{$relationType}Relation"; |
63 | 63 | |
64 | - if (! method_exists($this, $method)) { |
|
64 | + if (!method_exists($this, $method)) { |
|
65 | 65 | throw new RuntimeException("Unknown or unfillable relation type: {$key} of type ${relationType}"); |
66 | 66 | } |
67 | 67 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $relationType = $this->getRelationTypeName($relation); |
83 | 83 | $method = "connect{$relationType}Relation"; |
84 | 84 | |
85 | - if (! method_exists($this, $method)) { |
|
85 | + if (!method_exists($this, $method)) { |
|
86 | 86 | throw new RuntimeException("Unknown or unfillable connection type: {$key} of type ${relationType}"); |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function connectBelongsToRelation(Relations\BelongsTo $relation, $id) |
101 | 101 | { |
102 | - if (! $id) { |
|
102 | + if (!$id) { |
|
103 | 103 | $relation->dissociate(); |
104 | 104 | |
105 | 105 | return; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $relation->associate($model); |
112 | 112 | |
113 | - $this->queue(function () use ($schema) { |
|
113 | + $this->queue(function() use ($schema) { |
|
114 | 114 | $schema->authorizeToAdd($this->getModel()); |
115 | 115 | }); |
116 | 116 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function fillBelongsToRelation(Relations\BelongsTo $relation, $attributes = []) |
126 | 126 | { |
127 | - if (! $attributes) { |
|
127 | + if (!$attributes) { |
|
128 | 128 | $relation->dissociate(); |
129 | 129 | |
130 | 130 | return; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | $relation->associate($model); |
138 | 138 | |
139 | - $this->queue(function () use ($schema) { |
|
139 | + $this->queue(function() use ($schema) { |
|
140 | 140 | $schema->authorizeToAdd($this->getModel()); |
141 | 141 | }); |
142 | 142 | } |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function connectHasOneRelation(Relations\HasOne $relation, $id) |
152 | 152 | { |
153 | - if (! $id) { |
|
153 | + if (!$id) { |
|
154 | 154 | $relation->delete(); |
155 | 155 | |
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
159 | - $this->queue(function () use ($id, $relation) { |
|
159 | + $this->queue(function() use ($id, $relation) { |
|
160 | 160 | $model = $relation->getRelated()->findOrFail($id); |
161 | 161 | $this->authorizeToAdd($model); |
162 | 162 | $relation->save($model); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function fillHasOneRelation(Relations\HasOne $relation, $attributes) |
175 | 175 | { |
176 | - if (! $attributes) { |
|
176 | + if (!$attributes) { |
|
177 | 177 | $relation->delete(); |
178 | 178 | |
179 | 179 | return; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $modelSchema->authorizeToCreate(); |
185 | 185 | $modelSchema->fill($attributes); |
186 | 186 | |
187 | - $this->queue(function () use ($modelSchema, $relation) { |
|
187 | + $this->queue(function() use ($modelSchema, $relation) { |
|
188 | 188 | $this->authorizeToAdd($modelSchema->getModel()); |
189 | 189 | $relation->save($modelSchema->getInstance()); |
190 | 190 | $modelSchema->save(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function connectHasManyRelation(Relations\HasMany $relation, array $ids) |
202 | 202 | { |
203 | - $this->queue(function () use ($relation, $ids) { |
|
203 | + $this->queue(function() use ($relation, $ids) { |
|
204 | 204 | $models = $relation->getModel()->findMany($ids); |
205 | 205 | |
206 | 206 | foreach ($models as $model) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function fillHasManyRelation(Relations\HasMany $relation, array $values) |
222 | 222 | { |
223 | - $this->queue(function () use ($relation, $values) { |
|
223 | + $this->queue(function() use ($relation, $values) { |
|
224 | 224 | $related = $relation->getRelated(); |
225 | 225 | $relation->delete(); |
226 | 226 | |
@@ -269,20 +269,20 @@ discard block |
||
269 | 269 | ) { |
270 | 270 | $values = collect($values); |
271 | 271 | |
272 | - $this->queue(function () use ($detaching, $relation, $values) { |
|
272 | + $this->queue(function() use ($detaching, $relation, $values) { |
|
273 | 273 | $current = $relation->newQuery()->pluck($relation->getRelatedPivotKeyName()); |
274 | 274 | |
275 | 275 | if ($detaching) { |
276 | 276 | $detach = $current->diff($values); |
277 | 277 | |
278 | - $relation->getRelated()->newQuery()->findMany($detach)->each(function (Model $model) { |
|
278 | + $relation->getRelated()->newQuery()->findMany($detach)->each(function(Model $model) { |
|
279 | 279 | $this->authorizeToDetach($model); |
280 | 280 | }); |
281 | 281 | } |
282 | 282 | |
283 | 283 | $attach = $values->diff($current); |
284 | 284 | |
285 | - $relation->getRelated()->newQuery()->findMany($attach)->each(function (Model $model) { |
|
285 | + $relation->getRelated()->newQuery()->findMany($attach)->each(function(Model $model) { |
|
286 | 286 | $this->authorizeToAttach($model); |
287 | 287 | }); |
288 | 288 | |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | $pivotClass = $relation->getPivotClass(); |
310 | 310 | |
311 | 311 | // Returns an associative array of [ id => pivot ] |
312 | - $values = collect($values)->mapWithKeys(function ($data) use ($accessor, $relatedKey) { |
|
312 | + $values = collect($values)->mapWithKeys(function($data) use ($accessor, $relatedKey) { |
|
313 | 313 | return [$data[$relatedKey] => $data[$accessor] ?? []]; |
314 | - })->map(function ($attributes) use ($pivotClass) { |
|
314 | + })->map(function($attributes) use ($pivotClass) { |
|
315 | 315 | $instance = new $pivotClass; |
316 | 316 | $pivotSchema = $this->registry->getSchemaForModel($instance); |
317 | 317 | $pivotSchema->fill($attributes); |
@@ -319,20 +319,20 @@ discard block |
||
319 | 319 | return $pivotSchema->getInstance()->getAttributes(); |
320 | 320 | }); |
321 | 321 | |
322 | - $this->queue(function () use ($values, $detaching, $relation) { |
|
322 | + $this->queue(function() use ($values, $detaching, $relation) { |
|
323 | 323 | $current = $relation->newQuery()->pluck($relation->getRelatedPivotKeyName()); |
324 | 324 | |
325 | 325 | if ($detaching) { |
326 | 326 | $detach = $current->diff($values->keys()); |
327 | 327 | |
328 | - $relation->getRelated()->newQuery()->findMany($detach)->each(function (Model $model) { |
|
328 | + $relation->getRelated()->newQuery()->findMany($detach)->each(function(Model $model) { |
|
329 | 329 | $this->authorizeToDetach($model); |
330 | 330 | }); |
331 | 331 | } |
332 | 332 | |
333 | 333 | $attach = $values->keys()->diff($current); |
334 | 334 | |
335 | - $relation->getRelated()->newQuery()->findMany($attach)->each(function (Model $model) use ($values) { |
|
335 | + $relation->getRelated()->newQuery()->findMany($attach)->each(function(Model $model) use ($values) { |
|
336 | 336 | $this->authorizeToAttach($model, $values->get($model->getKey())); |
337 | 337 | }); |
338 | 338 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | $pivots[] = $attributes[$accessor] ?? null; |
362 | 362 | } |
363 | 363 | |
364 | - $this->queue(function () use ($detaching, $relation, $instances, $pivots) { |
|
365 | - $data = $instances->pluck('id')->mapWithKeys(function ($id, $key) use ($pivots) { |
|
364 | + $this->queue(function() use ($detaching, $relation, $instances, $pivots) { |
|
365 | + $data = $instances->pluck('id')->mapWithKeys(function($id, $key) use ($pivots) { |
|
366 | 366 | $pivot = $pivots[$key] ?? null; |
367 | 367 | |
368 | 368 | return $pivot ? [$id => $pivot] : [$key => $id]; |
@@ -370,11 +370,11 @@ discard block |
||
370 | 370 | |
371 | 371 | $results = $relation->sync($data, $detaching); |
372 | 372 | |
373 | - $relation->getRelated()->newQuery()->findMany($results['detached'])->each(function (Model $model) { |
|
373 | + $relation->getRelated()->newQuery()->findMany($results['detached'])->each(function(Model $model) { |
|
374 | 374 | $this->authorizeToDetach($model); |
375 | 375 | }); |
376 | 376 | |
377 | - $relation->getRelated()->newQuery()->findMany($results['attached'])->each(function (Model $model) { |
|
377 | + $relation->getRelated()->newQuery()->findMany($results['attached'])->each(function(Model $model) { |
|
378 | 378 | $this->authorizeToAttach($model); |
379 | 379 | }); |
380 | 380 | }); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | protected function connectMorphToRelation(Relations\MorphTo $relation, $data) |
391 | 391 | { |
392 | - if (! $data) { |
|
392 | + if (!$data) { |
|
393 | 393 | $relation->dissociate(); |
394 | 394 | |
395 | 395 | return; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | $data = collect($data); |
404 | 404 | |
405 | - [$key, $id] = $data->mapWithKeys(function ($item, $key) { |
|
405 | + [$key, $id] = $data->mapWithKeys(function($item, $key) { |
|
406 | 406 | return [$key, $item]; |
407 | 407 | }); |
408 | 408 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | protected function fillMorphToRelation(Relations\MorphTo $relation, $data) |
426 | 426 | { |
427 | - if (! $data) { |
|
427 | + if (!$data) { |
|
428 | 428 | $relation->dissociate(); |
429 | 429 | |
430 | 430 | return; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | $data = collect($data); |
439 | 439 | |
440 | - [$key, $attributes] = $data->mapWithKeys(function ($item, $key) { |
|
440 | + [$key, $attributes] = $data->mapWithKeys(function($item, $key) { |
|
441 | 441 | return [$key, $item]; |
442 | 442 | }); |
443 | 443 | |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | */ |
474 | 474 | protected function connectMorphManyRelation(Relations\MorphMany $relation, array $ids) |
475 | 475 | { |
476 | - $this->queue(function () use ($relation, $ids) { |
|
477 | - $relation->each(function (Model $model) use ($relation) { |
|
476 | + $this->queue(function() use ($relation, $ids) { |
|
477 | + $relation->each(function(Model $model) use ($relation) { |
|
478 | 478 | $model->setAttribute($relation->getMorphType(), null); |
479 | 479 | $model->setAttribute($relation->getForeignKeyName(), null); |
480 | 480 | $model->save(); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | protected function fillMorphManyRelation(Relations\MorphMany $relation, array $values) |
497 | 497 | { |
498 | - $this->queue(function () use ($relation, $values) { |
|
498 | + $this->queue(function() use ($relation, $values) { |
|
499 | 499 | $relation->delete(); |
500 | 500 | $related = $relation->getRelated(); |
501 | 501 | $relatedSchema = $this->registry->getSchemaForModel($related); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @throws \InvalidArgumentException |
16 | 16 | */ |
17 | -Builder::macro('bakeryPaginate', function ($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { |
|
17 | +Builder::macro('bakeryPaginate', function($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { |
|
18 | 18 | $page = $page ?: Paginator::resolveCurrentPage($pageName); |
19 | 19 | |
20 | 20 | $perPage = $perPage ?: $this->model->getPerPage(); |
@@ -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); |
@@ -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 ($relation, $modelSchema) { |
|
99 | - $query->each(function (Model $related) use ($modelSchema) { |
|
98 | + })->map(function(Relations\BelongsToMany $query) use ($relation, $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) use ($relation) { |
|
104 | + })->each(function(Relations\BelongsToMany $query) use ($relation) { |
|
105 | 105 | $query->detach(); |
106 | 106 | }); |
107 | 107 |