Skip to content

Commit df39ca8

Browse files
authored
Merge pull request #142 from Kim-Munbeom/master
fix : conditional relationships code fix
2 parents 4a389ce + 6c04513 commit df39ca8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models-relations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public function comments()
113113
return $this->hasMany(Comment::class);
114114
}
115115

116-
public function approved_comments()
116+
public function approvedComments()
117117
{
118-
return $this->hasMany(Comment::class)->where('approved', 1);
118+
return $this->comments()->where('approved', 1);
119119
}
120120
```
121121

0 commit comments

Comments
 (0)