Skip to content

Commit c991b15

Browse files
committed
fix index() method collision
1 parent cb8b912 commit c991b15

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function label($label)
129129
return $this;
130130
}
131131

132-
public function index($index)
132+
public function setIndex($index)
133133
{
134134
$this->index = $index;
135135

src/ColumnSet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function fromModelInstance($model)
2727
collect($model->getAttributes())->keys()->reject(function ($name) use ($model) {
2828
return in_array($name, $model->getHidden());
2929
})->map(function ($attribute, $index) {
30-
return Column::name($attribute)->index($index);
30+
return Column::name($attribute)->setIndex($index);
3131
})
3232
);
3333
}
@@ -43,7 +43,7 @@ public static function fromArray($columns)
4343
public static function squeezeIndex($columns)
4444
{
4545
foreach ($columns as $index => $column) {
46-
$column->index($index);
46+
$column->setIndex($index);
4747
}
4848

4949
return $columns;

src/Http/Livewire/LivewireDatatable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,6 @@ public function addBooleanFilters()
13161316
} elseif ($this->columnIsAggregateRelation($this->freshColumns[$index])) {
13171317
$this->addAggregateFilter($query, $index, $value);
13181318
} elseif ($this->freshColumns[$index]['type'] === 'string') {
1319-
ray($this->freshColumns[$index], $value)->red();
13201319
if ($value == 1) {
13211320
$query->whereNotNull($this->getColumnFilterStatement($index)[0])
13221321
->where($this->getColumnFilterStatement($index)[0], '<>', '');

tests/ColumnTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ public function it_returns_an_array_from_column()
9898
'filterOn' => null,
9999
'group' => null,
100100
'hideable' => null,
101+
'index' => 0,
102+
'minWidth' => null,
103+
'maxWidth' => null,
101104
], $subject);
102105
}
103106

@@ -138,6 +141,9 @@ public function it_returns_an_array_from_raw()
138141
'filterOn' => null,
139142
'group' => null,
140143
'hideable' => null,
144+
'index' => 0,
145+
'minWidth' => null,
146+
'maxWidth' => null,
141147
], $subject);
142148
}
143149

@@ -168,7 +174,6 @@ public function it_returns_width_property_from_column()
168174
'filterView' => null,
169175
'select' => null,
170176
'joins' => null,
171-
172177
'aggregate' => 'group_concat',
173178
'align' => 'left',
174179
'preventExport' => null,
@@ -178,6 +183,9 @@ public function it_returns_width_property_from_column()
178183
'filterOn' => null,
179184
'group' => null,
180185
'hideable' => null,
186+
'index' => 0,
187+
'minWidth' => null,
188+
'maxWidth' => null,
181189
], $subject);
182190
}
183191

0 commit comments

Comments
 (0)