Merge pull request #170 from shikorism/fix/visibility-issue-on-search
チェックイン非公開ユーザーのチェックインが検索結果として表示される問題の修正
This commit is contained in:
commit
3cba46bff0
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Ejaculation;
|
use App\Ejaculation;
|
||||||
use App\Tag;
|
use App\Tag;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class SearchController extends Controller
|
class SearchController extends Controller
|
||||||
{
|
{
|
||||||
@ -18,6 +19,12 @@ class SearchController extends Controller
|
|||||||
->whereHas('tags', function ($query) use ($inputs) {
|
->whereHas('tags', function ($query) use ($inputs) {
|
||||||
$query->where('name', 'like', "%{$inputs['q']}%");
|
$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)
|
->where('is_private', false)
|
||||||
->orderBy('ejaculated_date', 'desc')
|
->orderBy('ejaculated_date', 'desc')
|
||||||
->with(['user', 'tags'])
|
->with(['user', 'tags'])
|
||||||
|
Loading…
Reference in New Issue
Block a user