Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to authored and github-actions[bot] committed Jun 28, 2024
1 parent 856d837 commit c8a3b22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Laravel/Fields/Relationships/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function getPreparedFields(): FieldsCollection
{
return $this->getFields()->prepareAttributes()->prepareReindex(
parent: $this,
before: fn(self $parent, Field $field): FormElement => (clone $field)
before: fn (self $parent, Field $field): FormElement => (clone $field)
->setColumn("{$this->getPivotAs()}.{$field->getColumn()}")
->setNameAttribute($field->getColumn())
->setAttribute('class', 'pivotField')
Expand Down Expand Up @@ -296,7 +296,7 @@ protected function resolveValue(): mixed

return $value
->setRelations([
$this->getPivotAs() => $data[$value->getKey()] ?? []
$this->getPivotAs() => $data[$value->getKey()] ?? [],
])
->setAttribute($identityField->getColumn(), $data[$value->getKey()][$identityField->getColumn()] ?? false);
}
Expand Down Expand Up @@ -413,7 +413,7 @@ public function getCheckedKeys(): Collection
}

return $requestValues
->filter(static fn(array $value) => $value['_checked'])
->filter(static fn (array $value) => $value['_checked'])
->keys();

}
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/Fields/Relationships/BelongsToManyFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
function testBelongsToManyValue(TestResource $resource, Item $item, array $data, ?array $expectedData = null, ?array $pivotData = null)
{
$mapper = static function (array $d, array $p = []) {
return collect($d)->mapWithKeys(fn($v, $k) => [$k => [
return collect($d)->mapWithKeys(fn ($v, $k) => [$k => [
'_checked' => 1,
...$p[$k] ?? []
...$p[$k] ?? [],
]])->toArray();
};

if(!is_null($pivotData)) {
if(! is_null($pivotData)) {
$data = $mapper($data, $pivotData);
}

Expand All @@ -59,12 +59,12 @@ function testBelongsToManyValue(TestResource $resource, Item $item, array $data,

$real = $item->categories->pluck('id', 'id')->toArray();

if(!is_null($pivotData)) {
if(! is_null($pivotData)) {
$pivot = $item->categories->mapWithKeys(fn ($c) => [
$c->id => array_filter([
'pivot_1' => $c->pivot->pivot_1,
'pivot_2' => $c->pivot->pivot_2,
])
]),
])->toArray();

$real = $mapper($real, $pivot);
Expand Down

0 comments on commit c8a3b22

Please sign in to comment.