From a434a45e4a938f2513bce397a33672eeaf3f14c2 Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Wed, 25 Sep 2019 23:39:36 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=B0=E4=B8=80=E8=A6=A7=E3=81=AE?= =?UTF-8?q?=E4=BB=B6=E6=95=B0=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=82=92=E6=A4=9C=E7=B4=A2=E6=A9=9F=E8=83=BD=E3=81=A8?= =?UTF-8?q?=E6=8F=83=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/TagController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 3e489d5..0fb8859 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Tag; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; class TagController extends Controller @@ -18,7 +19,14 @@ SQL )) ->join('ejaculation_tag', 'tags.id', '=', 'ejaculation_tag.tag_id') ->join('ejaculations', 'ejaculations.id', '=', 'ejaculation_tag.ejaculation_id') + ->join('users', 'users.id', '=', 'ejaculations.user_id') ->where('ejaculations.is_private', false) + ->where(function ($query) { + $query->where('users.is_protected', false); + if (Auth::check()) { + $query->orWhere('users.id', Auth::id()); + } + }) ->groupBy('tags.name') ->orderByDesc('checkins_count') ->orderBy('tags.name')