File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/yajra/Datatables/Engines Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 8
8
9
9
##Change Log
10
10
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
+
11
16
###v5.11.0
12
17
- Add support for rendering view directly on addColumn and editColumn.
13
18
Original file line number Diff line number Diff line change 12
12
13
13
use Closure ;
14
14
use Illuminate \Contracts \Support \Arrayable ;
15
+ use Illuminate \Support \Arr ;
15
16
use Illuminate \Support \Collection ;
16
17
use Illuminate \Support \Str ;
17
18
use yajra \Datatables \Contracts \DataTableEngine ;
@@ -98,7 +99,7 @@ public function ordering()
98
99
function ($ row ) use ($ column ) {
99
100
$ row = Helper::castToArray ($ row );
100
101
101
- return $ row[ $ column] ;
102
+ return Arr:: get ( $ row, $ column) ;
102
103
}
103
104
);
104
105
@@ -123,15 +124,14 @@ function ($row) use ($columns) {
123
124
$ keyword = $ this ->request ->keyword ();
124
125
foreach ($ this ->request ->searchableColumnIndex () as $ index ) {
125
126
$ column = $ this ->getColumnName ($ index );
126
-
127
- if ( ! array_key_exists ($ column , $ data )) {
127
+ if ( ! $ value = Arr::get ($ data , $ column )) {
128
128
continue ;
129
129
}
130
130
131
131
if ($ this ->isCaseInsensitive ()) {
132
- $ found [] = Str::contains (Str::lower ($ data [ $ column ] ), Str::lower ($ keyword ));
132
+ $ found [] = Str::contains (Str::lower ($ value ), Str::lower ($ keyword ));
133
133
} else {
134
- $ found [] = Str::contains ($ data [ $ column ] , $ keyword );
134
+ $ found [] = Str::contains ($ value , $ keyword );
135
135
}
136
136
}
137
137
You can’t perform that action at this time.
0 commit comments