src/Bag.php
public function sortKeysBy(callable $iteratee, $order = SORT_ASC)
    {
        return $this->sortKeysWith($this->iterateeToComparator($iteratee, $order === SORT_ASC));
    }
public function sortKeysBy(callable $iteratee, $order = SORT_ASC)
    {
        return $this->sortKeysWith($this->iterateeToComparator($iteratee, $order === SORT_ASC));
    }
Returns a bag with the keys sorted based on the `$iteratee` function.

Example:

$bag = Bag::from([
'blue'  => 'a',
'red'   => 'b',
'black' => 'c',
]);

// Sort keys by first letter
$bag->sortKeysBy(function ($key) {
return $key[0];
});
// Bag of ['blue' => 'a', 'black' => 'c', 'red' => 'b']

@param callable $iteratee Function given `($key)`
@param int      $order    `SORT_ASC` or `SORT_DESC`

@return static