sksighna
6 days ago

How to acess the object inside the nested array in laravel

Posted 6 days ago by sksighna

I am new to laravel. I have an array called data which is fetching the data as a form of nested array. Its structure looks like this.

array:1 [▼
  0 => array:2 [▼
    0 => {#3 ▼
      +"id": "8"
      +"title": "Accounting"
      +"type": {
               +"id": "18"
                +"title": "BookKeeping"
           }
}
    1 => {#3 ▼
      +"id": "10"
      +"title": "Accounting"
      +"type": {
               +"id": "20"
                +"title": "Balancesheet"}
}
]
]

This is the data that I am getting in the form of a nested array. I need to find a maximum id i.e. 10 so that I can get the type title associates with the max id. I tried in several ways by using array helpers, and using foreach loop but could not succeed.Any kind of help and support is appreciated. Hope to get a positive rep

Please sign in or create an account to participate in this conversation.