@@ -369,7 +369,7 @@ private function clean_columns( $cols, $use_alias = true)
369
369
foreach ( $ cols as $ i => $ col )
370
370
{
371
371
preg_match ('#^(.*?)\s+as\s+(\S*?)$#si ' ,$ col ,$ matches );
372
- $ return [$ i ] = empty ($ matches ) ? $ col : $ matches [$ use_alias ?2 :1 ];
372
+ $ return [$ i ] = empty ($ matches ) ? $ col : $ matches [$ use_alias ?2 :1 ];
373
373
}
374
374
375
375
return $ return ;
@@ -384,7 +384,7 @@ private function clean_columns( $cols, $use_alias = true)
384
384
private function filtering ()
385
385
{
386
386
$ columns = $ this ->clean_columns ( $ this ->columns , false );
387
-
387
+
388
388
if (Input::get ('sSearch ' ,'' ) != '' )
389
389
{
390
390
$ copy_this = $ this ;
@@ -393,25 +393,25 @@ private function filtering()
393
393
$ this ->query ->where (function ($ query ) use ($ copy_this ) {
394
394
395
395
$ db_prefix = $ copy_this ->database_prefix ();
396
-
397
-
396
+
397
+
398
398
399
399
for ($ i =0 ,$ c =count ($ copy_this ->columns );$ i <$ c ;$ i ++)
400
400
{
401
401
if (Input::get ('bSearchable_ ' .$ i ) == "true " )
402
402
{
403
403
$ column = $ copy_this ->columns [$ i ];
404
-
405
- if (stripos ($ column , ' AS ' ) !== false ){
404
+
405
+ if (stripos ($ column , ' AS ' ) !== false ){
406
406
$ column = substr ($ column , stripos ($ column , ' AS ' )+4 );
407
407
}
408
-
408
+
409
409
$ keyword = '% ' .Input::get ('sSearch ' ).'% ' ;
410
410
411
411
if (Config::get ('datatables.search.use_wildcards ' , false )) {
412
412
$ keyword = $ copy_this ->wildcard_like_string (Input::get ('sSearch ' ));
413
413
}
414
-
414
+
415
415
// Check if the database driver is PostgreSQL
416
416
// If it is, cast the current column to TEXT datatype
417
417
$ cast_begin = null ;
@@ -420,10 +420,10 @@ private function filtering()
420
420
$ cast_begin = "CAST( " ;
421
421
$ cast_end = " as TEXT) " ;
422
422
}
423
-
423
+
424
424
$ column = $ db_prefix . $ column ;
425
425
if (Config::get ('datatables.search.case_insensitive ' , false )) {
426
- $ query ->orwhere (DB ::raw ('LOWER( ' .$ cast_begin .$ column .$ cast_end .') ' ), 'LIKE ' , $ keyword );
426
+ $ query ->orwhere (DB ::raw ('LOWER( ' .$ cast_begin .$ column .$ cast_end .') ' ), 'LIKE ' , strtolower ( $ keyword) );
427
427
} else {
428
428
$ query ->orwhere (DB ::raw ($ cast_begin .$ column .$ cast_end ), 'LIKE ' , $ keyword );
429
429
}
@@ -432,7 +432,7 @@ private function filtering()
432
432
});
433
433
434
434
}
435
-
435
+
436
436
$ db_prefix = $ this ->database_prefix ();
437
437
438
438
for ($ i =0 ,$ c =count ($ columns );$ i <$ c ;$ i ++)
@@ -447,7 +447,7 @@ private function filtering()
447
447
448
448
if (Config::get ('datatables.search.case_insensitive ' , false )) {
449
449
$ column = $ db_prefix . $ columns [$ i ];
450
- $ this ->query ->where (DB ::raw ('LOWER( ' .$ column .') ' ),'LIKE ' , $ keyword );
450
+ $ this ->query ->where (DB ::raw ('LOWER( ' .$ column .') ' ),'LIKE ' , strtolower ( $ keyword) );
451
451
} else {
452
452
$ col = strstr ($ columns [$ i ],'( ' )?DB ::raw ($ columns [$ i ]):$ columns [$ i ];
453
453
$ this ->query ->where ($ col , 'LIKE ' , $ keyword );
0 commit comments