Support the ongoing development of →
Database Eloquent Installation
Last updated 2 years ago.

Hi Skaya,

First of all i want to point out that in email class personas method relationship you have the person class spalled in correctly Persona.

Secondly, thought i do not know what you want to accomplish with your application, but if you are creating a email application the appropriate relationship would have been:

** Person hasMany Emails ** ** Email belongTo Person ***

In your currently defined relationship it says, single email belongs to many persons, Is that what you really want?

Now to answer your question to why you're getting undefined property when you try to access $person->emails->email is that you are getting back collection of data, therefore, you have to loop through the $person->email object.

I hope this helps.



I got it, my brain is not working properly lol.



Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.