Make correct menu item have active class

This commit is contained in:
dev 2021-08-06 19:45:24 -07:00
parent 6c5b68f379
commit 3f40402e83
2 changed files with 7 additions and 7 deletions

View File

@ -50,17 +50,17 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar --> <!-- Left Side Of Navbar -->
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li class="nav-item active"> <li class="nav-item {{ Request::routeIs('homepage') ? 'active' : '' }}">
<a class="nav-link" href="{{ route('homepage') }}">Home</a> <a class="nav-link" href="{{ route('homepage') }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item {{ Request::routeIs('about') ? 'active' : '' }}">
<a class="nav-link" href="{{ url('about') }}">About</a> <a class="nav-link" href="{{ route('about') }}">About</a>
</li> </li>
<li class="nav-item"> <li class="nav-item {{ Request::routeIs('leaderboard') ? 'active' : '' }}">
<a class="nav-link" href="{{ route('leaderboard') }}">Leaderboard</a> <a class="nav-link" href="{{ route('leaderboard') }}">Leaderboard</a>
</li> </li>
<li class="nav-item"> <li class="nav-item {{ Request::routeIs('submit') ? 'active' : '' }}">
<a class="nav-link" href="{{ route('meme') }}">Submit</a> <a class="nav-link" href="{{ route('submit') }}">Submit</a>
</li> </li>
</ul> </ul>

View File

@ -21,7 +21,7 @@ Route::get('/contact', [App\Http\Controllers\ContactController::class, 'index'])
Route::get('meme/{id}', [App\Http\Controllers\MemeController::class, 'show'])->name('meme'); Route::get('meme/{id}', [App\Http\Controllers\MemeController::class, 'show'])->name('meme');
Route::get('meme/approve/{id}', [App\Http\Controllers\MemeController::class, 'approve']); Route::get('meme/approve/{id}', [App\Http\Controllers\MemeController::class, 'approve']);
Route::get('meme/destroy/{id}', [App\Http\Controllers\MemeController::class, 'destroy']); Route::get('meme/destroy/{id}', [App\Http\Controllers\MemeController::class, 'destroy']);
Route::get('/submit/meme', [App\Http\Controllers\MemeController::class, 'create'])->name('meme')->middleware('auth'); Route::get('/submit/meme', [App\Http\Controllers\MemeController::class, 'create'])->name('submit')->middleware('auth');
Route::post('/meme-create', [App\Http\Controllers\MemeController::class, 'store'])->name('meme-create')->middleware('auth'); Route::post('/meme-create', [App\Http\Controllers\MemeController::class, 'store'])->name('meme-create')->middleware('auth');
Route::get('user/{id}', [App\Http\Controllers\UserController::class, 'show'])->name('user'); Route::get('user/{id}', [App\Http\Controllers\UserController::class, 'show'])->name('user');
Route::get('/dashboard', [App\Http\Controllers\DashboardController::class, 'index'])->name('dashboard'); Route::get('/dashboard', [App\Http\Controllers\DashboardController::class, 'index'])->name('dashboard');