Laravel - 数组获取属性

I'm working on something which requires me to get an attribute from an array, Which I thought was fairly simple. Weirdly I can't figure out how to get the attribute. The attributes that I need to achieve is the IP address in an array. If I dumpDie the object it returns the following

0 => Networks{#1010 ▼
  +ipAddress: "192.125.3.232"
  +gateway: "192.125.0.1"
  +type: "public"
  etc......

Now I need to receive the IP address from this array. How can I achieve that?

I've tried doing things like

$data['networks'][0]['ipAddress']; or $data->{'networks[0]'}->{'ipAddress'}

But both of them gave the error

Cannot use object of type DigitalOceanV2\Entity\Droplet as array

What is the solution to this problem?

EDIT

I get the object doing this

$droplet = DigitalOcean::droplet()->create($storeName, 'ams3', 's-1vcpu-1gb', $images[0]->id);

$data = DigitalOcean::droplet()->getById($droplet->id);

But both of them gave the error

Cannot use object of type DigitalOceanV2\Entity\Droplet as array

Because Droplet is an object, so you need to use -> to get the properties.

$data->networks[0]->ipAddress

Try this code, First check that you have values in $networks by,

$networks = $data['networks'];

And if $networks is not empty, Try this

$ipAddress = $networks[0]['ipAddress'];