タグをEager Loadするようにした

This commit is contained in:
shibafu 2018-01-08 10:28:12 +09:00
parent e0942889e9
commit 0c216e79c2
2 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,7 @@ class HomeController extends Controller
->where('ejaculations.link', '<>', '')
->orderBy('ejaculations.ejaculated_date', 'desc')
->select('ejaculations.*')
->with('user')
->with('user', 'tags')
->take(5)
->get();

View File

@ -36,6 +36,7 @@ SQL
$query = $query->where('is_private', false);
}
$ejaculations = $query->orderBy('ejaculated_date', 'desc')
->with('tags')
->paginate(20);
return view('user.profile')->with(compact('user', 'ejaculations'));
@ -116,6 +117,7 @@ SQL
$query = $query->where('is_private', false);
}
$ejaculations = $query->orderBy('ejaculated_date', 'desc')
->with('tags')
->paginate(20);
return view('user.profile')->with(compact('user', 'ejaculations'));