File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ primaryKey() {
127
127
### ` relations `
128
128
- Returns: ` object `
129
129
130
- This method can be implemented in the model to apply model instances to eager loaded relationships.
130
+ This method can be implemented in the model to apply model instances to eager loaded relationships.
131
+ It works for collections too.
131
132
132
133
It must return an object, which the key is the property of the relationship, and the value is the
133
134
model instance.
@@ -137,7 +138,7 @@ See [Configuration](/configuration#eager-loaded-relationships)
137
138
``` js
138
139
relations () {
139
140
return {
140
- relationKey : RelationModel
141
+ comments : Comment
141
142
}
142
143
}
143
144
```
@@ -153,7 +154,7 @@ It must receive a model instance as argument.
153
154
See [ Configuration] ( /configuration#lazy-loading-relationships )
154
155
155
156
``` js
156
- customMethod () {
157
- return this .hasMany (RelationModel )
157
+ comments () {
158
+ return this .hasMany (Comment )
158
159
}
159
160
```
You can’t perform that action at this time.
0 commit comments