title: Getting data from Laravel Collection
body: <p>I realize this is a dumb question, but I can't find an answer for it. I am missing some understanding around how collections work</p>
  
  <p>I am querying a google places API for information about a location</p>
  
  <pre><code> $response = GooglePlaces::textSearch('10 Downing Street', $optionnalParameters);
  </code></pre>
  
  <p>This works and gives me a response, which I can var_export:</p>
  
  <pre><code>   Illuminate\Support\Collection::__set_state(array(
     'items' =&gt; 
    array (
      'html_attributions' =&gt; 
      array (
      ),
      'results' =&gt; 
      Illuminate\Support\Collection::__set_state(array(
         'items' =&gt; 
        array (
          0 =&gt; 
          array (
            'formatted_address' =&gt; '10 Downing St, London SW1A 2AA, United Kingdom',
            'geometry' =&gt; 
            array (
              'location' =&gt; 
              array (
                'lat' =&gt; 51.503363499999999,
                'lng' =&gt; -0.12762480000000001,
              ),
              'viewport' =&gt; 
              array (
                'northeast' =&gt; 
                array (
                  'lat' =&gt; 51.503432400000001,
                  'lng' =&gt; -0.12551999999999999,
                ),
                'southwest' =&gt; 
                array (
                  'lat' =&gt; 51.503156800000014,
                  'lng' =&gt; -0.12832640000000001,
                ),
              ),
            ),
            'icon' =&gt; 'https://maps.gstatic.com/mapfiles/place_api/icons/civic_building-71.png',
            'id' =&gt; 'ffd85a3e543406e34703ee947c73ef54f5e167fe',
            'name' =&gt; '10 Downing Street',
            'photos' =&gt; 
            array (
              0 =&gt; 
              array (
                'height' =&gt; 2534,
                'html_attributions' =&gt; 
                array (
                  0 =&gt; '&lt;a href="https://maps.google.com/maps/contrib/117230111047681784763/photos"&gt;Christopher Chan&lt;/a&gt;',
                ),
                'photo_reference' =&gt; 'CoQBdwAAAHdqDNRUhalI7Ko_YXqckWM5M7I1IeD0xXOvjnxruS4BYCFnt99lCEy5xQJh7XtTvGTfZbKlnVhbxaJ_OloLxaPyoInqIpgRY-3LyB3Q70tDX3izeraFEM4Bw-ExmRzz6h18iMQlKb0DoDXnW26uO4RR-7YFjPNi6M0y5D7cmrl9EhAmI7GerM-TXpKD3BVVTtOWGhQZotS0ZNI2nK9G7jXxDEyvoQ5IxQ',
                'width' =&gt; 3801,
              ),
            ),
            'place_id' =&gt; 'ChIJRxzRQcUEdkgRGVaKyzmkgvg',
            'rating' =&gt; 3.3999999999999999,
            'reference' =&gt; 'CmRSAAAAh-Drhh9G_EW3azxZSikW_jR-ZjI2lhZTw6MfWqh9EiTaCEy4uW2okv_g6QfaKoupoeDu3DpfS6MjIvUvp6cc2uAoLlyH9NbkMrnQg9q3ED3R91OejmAScjRhe8G47kJ1EhD_oYVFakm4n6I27j-8iN6oGhQVH6rv1t6uGQBVVOqy1fCAB17JOg',
            'types' =&gt; 
            array (
              0 =&gt; 'point_of_interest',
              1 =&gt; 'establishment',
            ),
          ),
        ),
      )),
      'status' =&gt; 'OK',
    ),
  ))
  </code></pre>
  
  <p>I want to get the formatted_address element from the collection. it appears under the results element, that in turn has a collection under it with elements Items,0,formatted_address.</p>
  
  <p>when i start trying to 'walk down' to the element i require I get index not found for Items
            var_export($response['results']['items']);</p>
  
  <p>so essentially, how am I supposed to interact with collections? i have tried google but most the links  tell me about the extra functions that collections provide and not how to get data from it</p>
  
  <p>any help greatly appreciated.</p>