protected function findViewColumns(Builder $builder, Collection $collection) { if ($columns = $builder->getColumns()) { return $columns; } $src = $collection->getSrc(); if (!count($src)) { return [$builder->model()->getKeyName()]; } $firstResult = $src[0]; return array_keys($firstResult->getAttributes()); }
protected function findViewColumns(Search $search, Collection $collection) { if ($columns = $search->keys()) { return $columns; } $src = $collection->getSrc(); $modelClass = $search->modelClass(); $rootModel = new $modelClass(); if (!count($src)) { return [$rootModel->getKeyName()]; } $firstResult = $src[0]; return array_keys($firstResult->getAttributes()); }