feat: add auth guards and server-side logout with postcode search integration
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

- Add navigation guard requiring authentication for dashboard routes
- Create
This commit is contained in:
Ovidiu U
2026-04-11 17:08:19 +01:00
parent 4a3ce4cc1d
commit 03b0bece2c
4 changed files with 55 additions and 28 deletions

View File

@@ -1,9 +1,20 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
// Named dashboard route so route('dashboard') resolves; Vue Router handles rendering
Route::get('/dashboard', fn () => view('app'))->middleware(['auth', 'verified'])->name('dashboard');
// Server-side logout — handles hard navigation to /logout
Route::get('/logout', function (Request $request) {
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
})->middleware('auth')->name('logout');
// SPA catch-all — must be last
Route::get('/{any?}', fn () => view('app'))->where('any', '.*')->name('home');