Skip to content

Commit

Permalink
Merge branch 'release/v5.11.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra committed Aug 15, 2015
2 parents 19d5690 + b7fabd8 commit 938edc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

##Change Log

###v5.11.1
- Collection engine enhancement.
- Add support for filtering compound key PR #146.
- Add support for ordering using compound key.

###v5.11.0
- Add support for rendering view directly on addColumn and editColumn.

Expand Down
10 changes: 5 additions & 5 deletions src/yajra/Datatables/Engines/CollectionEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Closure;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use yajra\Datatables\Contracts\DataTableEngine;
Expand Down Expand Up @@ -98,7 +99,7 @@ public function ordering()
function ($row) use ($column) {
$row = Helper::castToArray($row);

return $row[$column];
return Arr::get($row, $column);
}
);

Expand All @@ -123,15 +124,14 @@ function ($row) use ($columns) {
$keyword = $this->request->keyword();
foreach ($this->request->searchableColumnIndex() as $index) {
$column = $this->getColumnName($index);

if ( ! array_key_exists($column, $data)) {
if ( ! $value = Arr::get($data, $column)) {
continue;
}

if ($this->isCaseInsensitive()) {
$found[] = Str::contains(Str::lower($data[$column]), Str::lower($keyword));
$found[] = Str::contains(Str::lower($value), Str::lower($keyword));
} else {
$found[] = Str::contains($data[$column], $keyword);
$found[] = Str::contains($value, $keyword);
}
}

Expand Down

0 comments on commit 938edc2

Please sign in to comment.