<?php array_intersect(array $array, array ...$arrays): array
<?php if ($selected = $this->resource->selectedQueryColumns()) { $diff = array_intersect($selected, $fields); $fields = empty($diff) ? $fields : $diff; }
<?php $model = $this->builder->getModel(); $schema = $model->getConnection()->getSchemaBuilder()->getColumnListing($model->getTable()); $selected = array_intersect($schema, $columns); } return empty($selected) ? ['*'] : $selected;