middleware(['auth', 'verified'])->name('dashboard'); Route::middleware('auth')->group(function () { Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit'); Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update'); Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); }); Route::get('/cart', [CartController::class, 'index'])->name('cart.index'); Route::post('/cart/add/{id}', [CartController::class, 'add'])->name('cart.add'); Route::post('/cart/remove/{id}', [CartController::class, 'remove'])->name('cart.remove'); Route::get('/my-orders', [CartController::class, 'customerOrders'])->name('customer.orders'); Route::get('/', function () { $totalProducts = \App\Models\Product::count(); // total items $gameCount = \App\Models\Product::select('game') ->distinct() ->count('game'); // unique games $categoryCounts = [ 'Genshin' => \App\Models\Product::where('game', 'Genshin')->count(), 'Starrail' => \App\Models\Product::where('game', 'Starrail')->count(), 'WutheringWave' => \App\Models\Product::where('game', 'WutheringWave')->count(), ]; // Get all custom games for the homepage $customGames = \App\Models\CustomGame::orderBy('name')->get(); return view('scroll_reveal_landing', compact( 'totalProducts', 'gameCount', 'categoryCounts', 'customGames' )); })->name('home'); Route::get('/store', [ProductController::class, 'categories'])->name('categories'); Route::get('/store/{category}', [ProductController::class, 'categoryProducts'])->name('store.category'); Route::get('/store/{category}/{product_name}', [ProductController::class, 'show'])->name('store.product'); // Products browsing route removed Route::get('/api/products/category/{game}', [ProductController::class, 'getByCategory'])->name('api.products.category'); Route::get('/api/search', [ProductController::class, 'search'])->name('api.search'); // Dashboard Analytics API Routes Route::prefix('api/dashboard')->group(function () { Route::get('/revenue', [App\Http\Controllers\Api\DashboardController::class, 'revenue'])->name('api.dashboard.revenue'); Route::get('/profit', [App\Http\Controllers\Api\DashboardController::class, 'profit'])->name('api.dashboard.profit'); Route::get('/sales', [App\Http\Controllers\Api\DashboardController::class, 'sales'])->name('api.dashboard.sales'); Route::get('/customers', [App\Http\Controllers\Api\DashboardController::class, 'customers'])->name('api.dashboard.customers'); Route::get('/summary', [App\Http\Controllers\Api\DashboardController::class, 'summary'])->name('api.dashboard.summary'); }); Route::post('/store', [ProductController::class, 'store'])->name('products.store'); // Old product URLs removed Route::put('/products/{id}', [ProductController::class, 'update'])->name('products.update'); Route::post('/checkout', [CartController::class, 'checkout'])->name('checkout.submit'); Route::middleware('auth')->group(function () { Route::get('/orders', [CartController::class, 'order'])->name('orders.index'); Route::delete('/orders/{id}', [CartController::class, 'deleteOrder'])->name('orders.delete'); Route::patch('/orders/{id}/complete', [CartController::class, 'completeOrder'])->name('orders.complete'); Route::patch('/orders/{id}/reject', [CartController::class, 'rejectOrder'])->name('orders.reject'); Route::get('/manage-products', [ProductController::class, 'listOFproduct'])->name('products.listOFproduct'); Route::delete('/products/{id}', [ProductController::class, 'destroy'])->name('products.destroy'); Route::post('/custom-games', [ProductController::class, 'storeCustomGame'])->name('custom-games.store'); Route::delete('/custom-games/{gameName}', [ProductController::class, 'deleteCustomGame'])->name('custom-games.destroy'); Route::get('/orders/{order}', [CartController::class, 'show'])->name('orders.show'); }); require __DIR__.'/auth.php';