Skip to content

Commit

Permalink
Merge pull request #2779 from yajra/analysis-QMbDn3
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
yajra authored May 8, 2022
2 parents 07fedfe + 590ead1 commit d1108e2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/CollectionDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function globalSearch($keyword)
$data = $this->serialize($row);
foreach ($this->request->searchableColumnIndex() as $index) {
$column = $this->getColumnName($index, 'sort');
$value = Arr::get($data, $column);
$value = Arr::get($data, $column);
if (! $value || is_array($value)) {
if (! is_numeric($value)) {
continue;
Expand Down
6 changes: 3 additions & 3 deletions src/DataTableAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ protected function setupKeyword($value)
/**
* Get column name to be use for filtering and sorting.
*
* @param int $index
* @param string|null $type
* @param bool $wantsAlias
* @param int $index
* @param string|null $type
* @param bool $wantsAlias
* @return string
*/
protected function getColumnName($index, $type = null, $wantsAlias = false)
Expand Down
21 changes: 10 additions & 11 deletions src/Processors/DataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,18 @@ protected function selectOnlyNeededColumns(array $data)
{
if (is_null($this->onlyColumns)) {
return $data;
} else {
$results = [];
foreach ($this->onlyColumns as $onlyColumn) {
Arr::set($results, $onlyColumn, Arr::get($data, $onlyColumn));
}
foreach ($this->exceptions as $exception) {
if ($column = Arr::get($data, $exception)) {
Arr::set($results, $exception, $column);
}
}
$results = [];
foreach ($this->onlyColumns as $onlyColumn) {
Arr::set($results, $onlyColumn, Arr::get($data, $onlyColumn));
}
foreach ($this->exceptions as $exception) {
if ($column = Arr::get($data, $exception)) {
Arr::set($results, $exception, $column);
}

return $results;
}

return $results;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/QueryDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,8 @@ protected function defaultOrdering()
$this->applyOrderColumn($column, $orderable);
} else {
$nullsLastSql = $this->getNullsLastSql($column, $orderable['direction']);
$normalSql = $this->wrap($column) . ' ' . $orderable['direction'];
$sql = $this->nullsLast ? $nullsLastSql : $normalSql;
$normalSql = $this->wrap($column) . ' ' . $orderable['direction'];
$sql = $this->nullsLast ? $nullsLastSql : $normalSql;
$this->query->orderByRaw($sql);
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/Utilities/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ public function keyword()
/**
* Get column identity from input or database.
*
* @param int $i
* @param string|null $type
* @param int $i
* @param string|null $type
* @return string
*/
public function columnName($i, $type = null)
Expand Down

0 comments on commit d1108e2

Please sign in to comment.