Skip to content

Commit

Permalink
Do not append table name if instance is expression.
Browse files Browse the repository at this point in the history
Fix #927.
  • Loading branch information
yajra committed Jan 20, 2017
1 parent 25b0ddc commit 4e0abf4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Engines/QueryBuilderEngine.php
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Database\Eloquent\Relations\HasOneOrMany;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
use Yajra\Datatables\Helper;
Expand Down Expand Up @@ -405,8 +406,10 @@ protected function addTablePrefix($query, $column)
$q = $query;
}

// Get table from query and add it.
$column = $q->from . '.' . $column;
if (! $q->from instanceof Expression) {
// Get table from query and add it.
$column = $q->from . '.' . $column;
}
}

return $this->wrap($column);
Expand Down

0 comments on commit 4e0abf4

Please sign in to comment.