myvideogamelist.com/routes/web.php

200 lines
7 KiB
PHP
Raw Permalink Normal View History

<?php
use App\Http\Controllers\Account\SettingsController;
use App\Http\Controllers\GameController;
use App\Http\Controllers\GameListController;
use App\Http\Controllers\GameSearchController;
// use App\Http\Controllers\GameReviewController;
// use App\Http\Controllers\PagesController;
use App\Http\Controllers\PlatformController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\WishlistController;
use App\Models\Game;
use Illuminate\Support\Facades\Route;
// Include our authentication routes.
require __DIR__ . '/auth.php';
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('pages.index');
})->name('index');
/*
|--------------------------------------------------------------------------
| Account Settings Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(SettingsController::class)->group(function () {
Route::middleware(['auth', 'verified'])->group(function () {
Route::prefix('account')->group(function () {
Route::get('settings', 'index')->name('settings.index');
Route::put('settings', 'update')->name('settings.update');
Route::put('settings/email', 'changeEmail')->name('settings.changeEmail');
Route::put('settings/password', 'changePassword')->name('settings.changePassword');
});
});
});
/*
|--------------------------------------------------------------------------
| Game Profile Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(GameController::class)->group(function () {
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/admin/games', 'index')->name('admin.games.index');
Route::get('/admin/game/create', 'create')->name('admin.game.create');
Route::get('/admin/game/clone/{gameId}', 'clone')->name('admin.game.clone');
Route::post('/admin/game/create', 'store')->name('admin.game.store');
Route::get('/admin/game/{game}/edit', 'edit')->name('admin.game.edit');
Route::put('/admin/game/{game}', 'update')->name('admin.game.update');
Route::delete('/admin/game/{game}', 'destroy')->name('admin.game.destroy');
});
Route::get('/game/{gameId}', function ($gameId) {
$gameName = str_replace('/', '_', str_replace(' ', '_', Game::findOrFail($gameId)->name));
return redirect()->route('game.show', ['gameId' => $gameId, 'gameName' => $gameName]);
})->whereNumber('gameId')->name('game.redirect.show');
Route::get('/game/{gameId}/{gameName}', 'show')->name('game.show');
});
/*
|--------------------------------------------------------------------------
| Game List Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(GameListController::class)->group(function () {
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/list', 'index')->name('games.list.index');
Route::get('/list/create/{gameId}', 'create')->name('games.list.create');
Route::post('/list/create', 'store')->name('games.list.store');
Route::get('/list/edit/{gameList}', 'edit')->name('games.list.edit');
Route::put('/list/{gameList}', 'update')->name('games.list.update');
Route::delete('/list/{gameList}', 'destroy')->name('games.list.destroy');
});
Route::get('/list/{user}', 'index')->name('games.list.user.index');
});
/*
|--------------------------------------------------------------------------
| Game Reviews Routes
|--------------------------------------------------------------------------
|
*/
// Route::controller(GameReviewController::class)->group(function () {
// Route::get('/game-reviews', 'index')->name('game-reviews.index');
// });
Route::get('/game-reviews', function () {
return view('pages.game-reviews.index');
})->name('game-reviews.index');
/*
|--------------------------------------------------------------------------
| Game Search Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(GameSearchController::class)->group(function () {
Route::paginate('/search/games', 'search')->name('game.search');
});
/*
|--------------------------------------------------------------------------
| Misc Routes
|--------------------------------------------------------------------------
|
*/
Route::get('/contact-us', function () {
return view('pages.contact-us.index');
})->name('contact-us.index');
Route::get('/newly-added-games', function () {
return view('pages.misc.newly-added-games');
})->name('misc.newly-added-games');
Route::get('/privacy-policy', function () {
return view('pages.privacy-policy.index');
})->name('privacy-policy');
Route::get('/recent-gamer-updates', function () {
return view('pages.misc.recent-gamer-updates');
})->name('misc.recent-gamer-updates');
Route::get('/terms-of-service', function () {
return view('pages.terms-of-service.index');
})->name('terms-of-service');
/*
|--------------------------------------------------------------------------
| Platform Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(PlatformController::class)->group(function () {
Route::get('/platforms', 'index')->name('platforms.index');
Route::paginate('/platform/{platform}', 'show')->name('platform.show');
});
/*
|--------------------------------------------------------------------------
| Profile Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(UserController::class)->group(function () {
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/profile', 'show')->name('profile.show');
});
Route::get('/profile/{user}', 'show')->name('profile.user.show');
});
/*
|--------------------------------------------------------------------------
| Support Routes
|--------------------------------------------------------------------------
|
*/
Route::get('/support', function () {
return view('pages.support.index');
})->name('support.index');
Route::get('/support/knowledgebase', function () {
return view('pages.support.knowledgebase.index');
})->name('support.knowledgebase.index');
/*
|--------------------------------------------------------------------------
| Wishlist Routes
|--------------------------------------------------------------------------
|
*/
Route::controller(WishlistController::class)->group(function () {
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/wishlist', 'show')->name('wishlist.show');
});
Route::get('/wishlist/{user}', 'show')->name('wishlist.user.show');
});