-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel relationship not working #162
Comments
Hey @XPOL555 , What you describe is logic.
So GraphQLite needs to target the magic property and not the method. Since GraphQLite has no way to target a magic property (I'm working to improve that), you need instead to apply the @field annotation on a getter that wraps the property. So here is what you want to do: class Company extends Model{
public function addresses() {
return $this->hasMany('App\Address');
}
/**
* @Field()
* @return Address[]
*/
public function getAddresses():iterable {
return $this->addresses;
}
} Let me know, this should work. |
Thank you @moufmouf for the quick reply and... yess! It works like magic! Thank you so much. I also changed to a |
@moufmouf just migrated from dev to v4 and had no issues - great work guys! |
When Declaring a model with an hasMany
I got this message:
is this intended? I expect to directly query the related model
NB: i'm using v4 dev-master on laravel 6
The text was updated successfully, but these errors were encountered: