Closed AxelPariss closed 4 years ago
Hi ! Sorry for the dump question I guess 😅 I have this relation : competition→hasMany→category→hasMany→registration
competition
category
registration
I do this from my Competition model (and it works great) :
public function registrations(){ return $this->hasManyDeep('App\Registration', ['App\Category', 'App\Team']); }
But I want to access to a competition from a registration, and I do this but I think it's wrong (because I have an error 😂)
public function competition(){ return $this->hasManyDeep('App\Competition', ['App\Category', 'App\Team']); }
In fact, I don't understand how belongs relationships works, do you have any idea to have this thing working? Thanks !
Ahah it was a very dumb question XD I found this package which works PERFECT! thank you so much for your work 😇
https://github.com/staudenmeir/belongs-to-through
Hi ! Sorry for the dump question I guess 😅 I have this relation :
competition
→hasMany→category
→hasMany→registration
I do this from my Competition model (and it works great) :
But I want to access to a competition from a registration, and I do this but I think it's wrong (because I have an error 😂)
In fact, I don't understand how belongs relationships works, do you have any idea to have this thing working? Thanks !