Skip to content

Commit 6c04513

Browse files
committed
fix : conditional relationships code fix
1 parent 4a389ce commit 6c04513

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)