Created
February 12, 2018 20:48
-
-
Save burningTyger/2356dc40946571d54a268ce1d2f36632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseModel extends Model { | |
static get allRelations() { | |
return '[' + Object.keys(this.relationMappings).join(',') + ']'; | |
} | |
} | |
//And then inherit your models from that instead of Model. | |
class Person extends BaseModel { | |
//... | |
} | |
//and then you can do this: | |
Person.query().eager(Person.allRelations) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment