src/Bag.php
public function column($columnKey, $indexKey = null)
    {
        return $this->createFrom(Arr::column($this->items, $columnKey, $indexKey));
    }
public function column($columnKey, $indexKey = null)
    {
        return $this->createFrom(Arr::column($this->items, $columnKey, $indexKey));
    }
public function column ( $ columnKey , $ indexKey = null ) { return $ this -> createFrom ( Arr :: column ( $ this -> items , $ columnKey , $ indexKey ) ) ; }
Returns a bag with the values from a single column, identified by the `$columnKey`.

Optionally, an `$indexKey` may be provided to index the values in the
returned Bag by the values from the `$indexKey` column.

Example:

$bag = Bag::from([
['id' => 10, 'name' => 'Alice'],
['id' => 20, 'name' => 'Bob'],
['id' => 30, 'name' => 'Carson'],
]);

$bag->column('name');
// => Bag of ['Alice', 'Bob', 'Carson']

$bag->column('name', 'id');
// => Bag of [10 => 'Alice', 20 => 'Bob', 30 => 'Carson']

@param string|int|null $columnKey The key of the values to return or `null` for no change
@param string|int|null $indexKey  The key of the keys to return or `null` for no change

@return static
Returns a bag with the values from a single column identified by the $columnKey .