7 months ago

JSON array get property

Posted 7 months ago by Vishaal


I have an JSON array and i need to get the id of it.

[{"id":2,"title":"Default Pool","_lft":2,"_rgt":7,"parent_id":1,"created_at":"2019-04-12 18:27:50","updated_at":"2019-04-12 18:27:50"},{"id":3,"title":"sdf","_lft":3,"_rgt":4,"parent_id":2,"created_at":"2019-04-12 18:35:46","updated_at":"2019-04-12 18:35:46"}]

When i'm doing

$poolnaam = Pool::find($test2);

$id = $poolnaam->id;

it gives me the following error: Property [id] does not exist on this collection instance.

How i can get the property from the array?

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