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.
Thanks.
I got it, my brain is not working properly lol.
$person->emails->first()->email;
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community