rename view/route

This commit is contained in:
shibafu 2020-05-24 17:35:58 +09:00
parent 019412c72a
commit 2f4c61c900
4 changed files with 8 additions and 9 deletions

View File

@ -64,7 +64,7 @@ SQL
return view('user.profile')->with(compact('user', 'ejaculations', 'tags'));
}
public function statsAll($name)
public function stats($name)
{
$user = User::where('name', $name)->first();
if (empty($user)) {
@ -74,7 +74,7 @@ SQL
$availableMonths = $this->makeStatsAvailableMonths($user);
$graphData = $this->makeGraphData($user);
return view('user.stats.all')->with(compact('user', 'graphData', 'availableMonths'));
return view('user.stats.index')->with(compact('user', 'graphData', 'availableMonths'));
}
public function statsYearly($name, $year)

View File

@ -3,8 +3,8 @@
@section('sidebar')
@if (!$user->is_protected || $user->isMe())
<div class="nav d-none d-lg-flex flex-column nav-pills" aria-orientation="vertical">
<a class="nav-link {{ Route::currentRouteName() === 'user.stats.all' ? 'active' : '' }}"
href="{{ route('user.stats.all', ['name' => $user->name]) }}">全期間</a>
<a class="nav-link {{ Route::currentRouteName() === 'user.stats' ? 'active' : '' }}"
href="{{ route('user.stats', ['name' => $user->name]) }}">全期間</a>
@foreach ($availableMonths as $year => $months)
<div class="border-top mt-1">
<a class="nav-link mt-1 {{ Route::currentRouteName() === 'user.stats.yearly' && $currentYear === $year ? 'active' : '' }}"
@ -33,16 +33,16 @@
<ul class="nav nav-pills nav-fill">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
{{ Route::currentRouteName() === 'user.stats.all' ? '全期間' : "{$currentYear}" }}
{{ Route::currentRouteName() === 'user.stats' ? '全期間' : "{$currentYear}" }}
</a>
<div class="dropdown-menu">
<a href="{{ route('user.stats.all', ['name' => $user->name]) }}" class="dropdown-item">全期間</a>
<a href="{{ route('user.stats', ['name' => $user->name]) }}" class="dropdown-item">全期間</a>
@foreach ($availableMonths as $year => $months)
<a href="{{ route('user.stats.yearly', ['name' => $user->name, 'year' => $year]) }}" class="dropdown-item">{{ $year }}</a>
@endforeach
</div>
</li>
@if (Route::currentRouteName() === 'user.stats.all')
@if (Route::currentRouteName() === 'user.stats')
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle disabled"
href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">全期間</a>

View File

@ -17,8 +17,7 @@ Route::get('/', 'HomeController@index')->name('home');
Route::get('/user', 'UserController@redirectMypage')->middleware('auth');
Route::get('/user/{name?}', 'UserController@profile')->name('user.profile');
Route::redirect('/user/{name}/stats', '/user/{name}/stats/all')->name('user.stats');
Route::get('/user/{name}/stats/all', 'UserController@statsAll')->name('user.stats.all');
Route::get('/user/{name}/stats', 'UserController@stats')->name('user.stats');
Route::get('/user/{name}/stats/{year}', 'UserController@statsYearly')->name('user.stats.yearly');
Route::get('/user/{name}/stats/{year}/{month}', 'UserController@statsMonthly')->name('user.stats.monthly');
Route::get('/user/{name}/okazu', 'UserController@okazu')->name('user.okazu');