Skip to content

Commit 938edc2

Browse files
committed
Merge branch 'release/v5.11.1'
2 parents 19d5690 + b7fabd8 commit 938edc2

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

change-log.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
##Change Log
1010

11+
###v5.11.1
12+
- Collection engine enhancement.
13+
- Add support for filtering compound key PR #146.
14+
- Add support for ordering using compound key.
15+
1116
###v5.11.0
1217
- Add support for rendering view directly on addColumn and editColumn.
1318

src/yajra/Datatables/Engines/CollectionEngine.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
use Closure;
1414
use Illuminate\Contracts\Support\Arrayable;
15+
use Illuminate\Support\Arr;
1516
use Illuminate\Support\Collection;
1617
use Illuminate\Support\Str;
1718
use yajra\Datatables\Contracts\DataTableEngine;
@@ -98,7 +99,7 @@ public function ordering()
9899
function ($row) use ($column) {
99100
$row = Helper::castToArray($row);
100101

101-
return $row[$column];
102+
return Arr::get($row, $column);
102103
}
103104
);
104105

@@ -123,15 +124,14 @@ function ($row) use ($columns) {
123124
$keyword = $this->request->keyword();
124125
foreach ($this->request->searchableColumnIndex() as $index) {
125126
$column = $this->getColumnName($index);
126-
127-
if ( ! array_key_exists($column, $data)) {
127+
if ( ! $value = Arr::get($data, $column)) {
128128
continue;
129129
}
130130

131131
if ($this->isCaseInsensitive()) {
132-
$found[] = Str::contains(Str::lower($data[$column]), Str::lower($keyword));
132+
$found[] = Str::contains(Str::lower($value), Str::lower($keyword));
133133
} else {
134-
$found[] = Str::contains($data[$column], $keyword);
134+
$found[] = Str::contains($value, $keyword);
135135
}
136136
}
137137

0 commit comments

Comments
 (0)