Closed pmn4 closed 3 months ago
can you expand on what this is fixing?
oops, this isn't a good example. the user method should return the User class. I tried to make my example simpler, and instead made it confusing! instead, consider a User class that has a parent relationship, where parent is another record in the User table. you could say:
@belong_to
def parent(self):
return User
or
@belong_to
def parent(self):
return self.__class__
when migrating from Orator to Masonite, several of my relationship methods were not working. Stepping through the code, I found that when referencing the
class
viaself.__class__
inside theUser
class,self
was an instance ofBelongsTo
, notUser
. This PR aims to pass an instance ofUser
instead.