From e89a7bb329abf3cd252fea7f624acbc454d7caf4 Mon Sep 17 00:00:00 2001 From: Frankie B Date: Tue, 11 Jun 2024 21:36:58 +0100 Subject: Add pageview logging via PostHog --- routes/web.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'routes/web.php') diff --git a/routes/web.php b/routes/web.php index b87d32d..6456439 100644 --- a/routes/web.php +++ b/routes/web.php @@ -9,6 +9,7 @@ use App\Http\Controllers\ComputersController; use App\Http\Controllers\GuestbookController; use App\Http\Controllers\HomeController; use App\Http\Controllers\MusicController; +use App\Http\Middleware\PageView; use Illuminate\Support\Facades\Route; /* @@ -22,14 +23,18 @@ use Illuminate\Support\Facades\Route; | */ -Route::get('/', [HomeController::class, 'show']); -Route::get('/bookmarks', [BookmarksController::class, 'show']); -Route::get('/guestbook', [GuestbookController::class, 'show']); +// Run the PageView middleware for *all* public GET routes +Route::middleware(PageView::class)->group(function () { + Route::get('/', [HomeController::class, 'show']); + Route::get('/bookmarks', [BookmarksController::class, 'show']); + Route::get('/guestbook', [GuestbookController::class, 'show']); + Route::get('/calculators', [CalculatorsController::class, 'show']); + Route::get('/computers', [ComputersController::class, 'show']); + Route::get('/music', [MusicController::class, 'show']); +}); + Route::post('/guestbook', [GuestbookController::class, 'addEntry']) ->middleware('rate_limit'); -Route::get('/calculators', [CalculatorsController::class, 'show']); -Route::get('/computers', [ComputersController::class, 'show']); -Route::get('/music', [MusicController::class, 'show']); // Admin pages Route::get('/admin/guestbook', [AdminGuestbookController::class, 'show']) -- cgit v1.2.3-54-g00ecf