Skip to content

Commit 6fc7f17

Browse files
committed
Merge pull request yajra#245 from lisa-fehr/patch-4
Sort by a multi-line 'select as' query
2 parents dc7b41a + c123624 commit 6fc7f17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/yajra/Datatables/Datatables.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ public static function of($builder)
295295
*/
296296
private function getColumnName($str)
297297
{
298-
preg_match('#^(\S*?)\s+as\s+(\S*?)$#si', $str, $matches);
298+
$matches = explode(' as ', Str::lower($str));
299299

300300
if (! empty($matches)) {
301-
return $matches[2];
301+
return array_pop($matches);
302302
} elseif (strpos($str, '.')) {
303303
$array = explode('.', $str);
304304

0 commit comments

Comments
 (0)