From 9cec184d210e1cc9a24dc78fb5af5f54ade7177a Mon Sep 17 00:00:00 2001 From: shibafu Date: Sun, 7 Apr 2019 00:10:01 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E9=9D=9E=E5=85=AC=E9=96=8B=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=8C=E6=A4=9C=E7=B4=A2=E7=B5=90=E6=9E=9C=E3=81=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/SearchController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 3fa2725..271a003 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Ejaculation; use App\Tag; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; class SearchController extends Controller { @@ -18,6 +19,12 @@ class SearchController extends Controller ->whereHas('tags', function ($query) use ($inputs) { $query->where('name', 'like', "%{$inputs['q']}%"); }) + ->whereHas('user', function ($query) { + $query->where('is_protected', false); + if (Auth::check()) { + $query->orWhere('id', Auth::id()); + } + }) ->where('is_private', false) ->orderBy('ejaculated_date', 'desc') ->with(['user', 'tags'])