aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2024-06-11 21:36:58 +0100
committerFrankie B <git@diskfloppy.me>2024-06-11 21:36:58 +0100
commite89a7bb329abf3cd252fea7f624acbc454d7caf4 (patch)
tree20808feb8932992013d25143bc9f4d12fa737b23 /routes
parent210363d17371a699b33a9502bd0f017dca98f915 (diff)
Add pageview logging via PostHog
Diffstat (limited to 'routes')
-rw-r--r--routes/web.php17
1 files changed, 11 insertions, 6 deletions
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'])