John Davidson

json - Accessing property of object inside object PHP Laravel

0 comments
Message:


I have struggled with my Laravel project.
I have searched but still not find the solution.


My data object like:


{
id: 1,
patients: {
id: 2,
patient_registrant: {
id: 3,
name: "Registrant name"
}
}
}

I want to access the object of name property inside patient_registrant


If I try $data->patients->id the result is 2.


I've tried like $data->patients->patient_registrant->name; but the result is property name is non-object


Please give me some clue, or keywords for this case. Thanks guys



My Answer:
John Doe_ },_ patient_name: "Jane Doe"_ }_}_I want to access the name property inside the patient_registrant object in Laravel. How can I achieve this?

Rate this post

3 of 5 based on 3194 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us