Laravel - Collections - Method Flip

The flip method swaps the collection's keys with their corresponding values:

    
    $collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
    
    $flipped = $collection->flip();
    
    $flipped->all();
    
    // ['taylor' => 'name', 'laravel' => 'framework']