Having a object of Illuminate\Database\Eloquent\Builder type, how can I access the array of currently selected columns?
Illuminate\Database\Eloquent\Builder
Get the public $columns property from the base query builder:
$columns
$columns = $query->getQuery()->columns;