Merge pull request #221 from bagisto/jitendra

Now raw expression will work on select raw         dd(->columns);
This commit is contained in:
JItendra Singh 2018-11-28 16:33:46 +05:30 committed by GitHub
commit 4eef920472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -67,11 +67,11 @@ class CustomerDataGrid
'sortable' => true,
],
[
'name' => 'first_name',
'alias' => 'FirstName',
'name' => 'CONCAT(first_name, " ", last_name)',
'alias' => 'Name',
'type' => 'string',
'label' => 'First Name',
'sortable' => false,
'label' => 'Name',
'sortable' => true,
],
[
'name' => 'email',

View File

@ -456,16 +456,14 @@ class DataGrid
{
$select = [];
foreach ($this->columns as $column) {
$select[] = $column->name.' as '.$column->alias;
$this->query->addselect(DB::raw($column->name.' as '.$column->alias));
}
$this->query->select(...$select);
// $this->query->select(...$select);
if ($this->select) {
$this->query->addselect($this->select);
}
// dd($this->query);
}
/**