Fix the number of queries being made
This commit is contained in:
parent
d41d085853
commit
f16034d963
3 changed files with 5 additions and 3 deletions
|
@ -8,13 +8,15 @@ class BookmarksController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
$bookmarks = Bookmark::with('tags')->latest()->paginate(10);
|
||||
$bookmarks = Bookmark::latest()->with('tags')->withCount('tags')->paginate(10);
|
||||
|
||||
return view('bookmarks.index', compact('bookmarks'));
|
||||
}
|
||||
|
||||
public function show(Bookmark $bookmark)
|
||||
{
|
||||
$bookmark->loadMissing('tags');
|
||||
|
||||
return view('bookmarks.show', compact('bookmark'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue