Skip to content

Commit b534c0e

Browse files
committed
Merge pull request #67 from uibar/patch-1
Update README for proper eager loading
2 parents 372e943 + 357a546 commit b534c0e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ class Article extends \Illuminate\Database\Eloquent\Model {
4545
#### Quick Sample Usage
4646

4747
```php
48-
$article = Article::with('tagged')->first(); // eager load
48+
$article = Article::with(['tagged' => function($query) {
49+
$query->with('tag');
50+
}])
51+
->first(); // eager load
4952

5053
foreach($article->tagged as $tagged) {
5154
echo $tagged->tag_name . ' with url slug of ' . $tagged->tag_slug;

0 commit comments

Comments
 (0)