From 0c216e79c28adc4bc5793890efaa4464bdf624f8 Mon Sep 17 00:00:00 2001 From: shibafu Date: Mon, 8 Jan 2018 10:28:12 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=B0=E3=82=92Eager=20Load?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/HomeController.php | 2 +- app/Http/Controllers/UserController.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 6acdc6a..4d655e8 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 572ef8b..9657002 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -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'));