title: to to get data from specific index in multidimensional array to avoid use of many foreach loops
body: <p>I am trying to get data in from multidimensional array without using foreach 
  i tried using in_array() function but not worked</p>
  
  <pre><code>$abc =  array()
  in_array($abc , $private_job-&gt;cities)
  
  in_array() expects parameter 2 to be array, string given
  </code></pre>
  
  <p>on using <code>$private_job-&gt;cities</code> got the following result</p>
  
  <pre><code>Collection {#408 ▼
    #items: array:2 [▼
      0 =&gt; city {#416 ▼
        +wasRecentlyCreated: false
        #attributes: array:2 [▼
          "id" =&gt; 7
          "city_name" =&gt; "Gujranwala"
      ]
  
      }
      1 =&gt; city {#417 ▼
        +wasRecentlyCreated: false
        #attributes: array:2 [▶]
        #original: array:4 [▼
          "id" =&gt; 4
          "city_name" =&gt; "Islamabad"
          "pivot_private_jobabd_id" =&gt; 53
          "pivot_city_id" =&gt; 4
        ]
  
      }
    ]
  }
  </code></pre>
  
  <p>whereas i am interested in getting</p>
  
  <pre><code>"id" =&gt; 7
  "id" =&gt; 4
  </code></pre>
  
  <p>in an an <code>array</code></p>