Closed marksie1988 closed 7 years ago
dd($teams->social);
?
Laravel should try to save time, so you have to explicitly call the relationship or eager load it
Unfortunately that doesn't seem to work, when i call $teams->social it states that the property doesn't exist on the collection
Ok I have fixed it, for some reason it needed me to mention the local and foreign key even though I was using the laravel standard naming :)
Hey there,
I am currently trying to setup a one to many relationship between my "social" table and the "team" table.
I have done the following: my social table has the following columns: id, provider, oauth_key, oauth_secret, team_id
in my Team.php Model:
in my Social.php Model:
then on the Team index call
dd($teams)
but there is no relationship shown for the social table. I am not sure why it isnt picking up the relationship from the models, is there something im missing? according to the Laravel documents i should only need to add to the models to form the relationship?