Laravel - Collections - Method Sortkeys

The sortKeys method sorts the collection by the keys of the underlying associative array:

    
    $collection = collect([
        'id' => 22345,
        'first' => 'John',
        'last' => 'Doe',
    ]);
    
    $sorted = $collection->sortKeys();
    
    $sorted->all();
    
    /*
        [
            'first' => 'John',
            'id' => 22345,
            'last' => 'Doe',
        ]
    */