Skip to content

Commit f32b406

Browse files
committed
Improve mapping of response.
1 parent 1a73c1a commit f32b406

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Services/DataTable.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,10 @@ public function builder()
301301
*/
302302
protected function mapResponseToColumns($columns, $type)
303303
{
304-
return array_map(function ($row) use ($columns, $type) {
305-
if ($columns) {
306-
return (new DataArrayTransformer())->transform($row, $columns, $type);
307-
}
304+
$transformer = new DataArrayTransformer;
308305

309-
return $row;
306+
return array_map(function ($row) use ($columns, $type, $transformer) {
307+
return $transformer->transform($row, $columns, $type);
310308
}, $this->getAjaxResponseData());
311309
}
312310

@@ -608,8 +606,7 @@ protected function hasScopes(array $scopes, $validateAll = false)
608606
return in_array(get_class($scope), $scopes);
609607
});
610608

611-
return $validateAll ? count($filteredScopes) === count($scopes) :
612-
! empty($filteredScopes);
609+
return $validateAll ? count($filteredScopes) === count($scopes) : ! empty($filteredScopes);
613610
}
614611

615612
/**

0 commit comments

Comments
 (0)