Merge pull request #171 from shikorism/develop

Release 20190407.0014
This commit is contained in:
shibafu 2019-04-07 00:15:38 +09:00 committed by GitHub
commit 6b1ccc52e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 3 deletions

View File

@ -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'])

View File

@ -67,6 +67,8 @@ SQL
abort(404); abort(404);
} }
$dateUntil = now()->addMonth()->startOfMonth();
$groupByDay = Ejaculation::select(DB::raw( $groupByDay = Ejaculation::select(DB::raw(
<<<'SQL' <<<'SQL'
to_char(ejaculated_date, 'YYYY/MM/DD') AS "date", to_char(ejaculated_date, 'YYYY/MM/DD') AS "date",
@ -74,6 +76,7 @@ count(*) AS "count"
SQL SQL
)) ))
->where('user_id', $user->id) ->where('user_id', $user->id)
->where('ejaculated_date', '<', $dateUntil)
->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')")) ->groupBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')")) ->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
->get(); ->get();
@ -85,6 +88,7 @@ count(*) AS "count"
SQL SQL
)) ))
->where('user_id', $user->id) ->where('user_id', $user->id)
->where('ejaculated_date', '<', $dateUntil)
->groupBy(DB::raw("to_char(ejaculated_date, 'HH24')")) ->groupBy(DB::raw("to_char(ejaculated_date, 'HH24')"))
->orderBy(DB::raw('1')) ->orderBy(DB::raw('1'))
->get(); ->get();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -4,6 +4,7 @@
"description": "気持ちよくティッシュを使った、そのあとの感想戦。", "description": "気持ちよくティッシュを使った、そのあとの感想戦。",
"display": "minimal-ui", "display": "minimal-ui",
"start_url": "/", "start_url": "/",
"theme_color": "#e53fb1",
"share_target": { "share_target": {
"action": "/checkin", "action": "/checkin",
"method": "GET", "method": "GET",

View File

@ -58,7 +58,7 @@
<!-- span --> <!-- span -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<h5> <h5>
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> {{ $ejaculation->user->display_name }}</a> <a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> <bdi>{{ $ejaculation->user->display_name }}</bdi></a>
<a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a> <a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a>
</h5> </h5>
<div> <div>

View File

@ -10,7 +10,7 @@
<!-- span --> <!-- span -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<h5> <h5>
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> {{ $ejaculation->user->display_name }}</a> <a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> <bdi>{{ $ejaculation->user->display_name }}</bdi></a>
<a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a> <a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a>
</h5> </h5>
<div> <div>

View File

@ -14,7 +14,7 @@
<!-- span --> <!-- span -->
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<h5> <h5>
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> {{ $ejaculation->user->display_name }}</a> <a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> <bdi>{{ $ejaculation->user->display_name }}</bdi></a>
<a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a> <a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a>
</h5> </h5>
<div> <div>