Skip to content
Snippets Groups Projects
Commit 82fec7e2 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

redirect to named routes

parent d1e563a7
No related branches found
No related tags found
No related merge requests found
Pipeline #31503 failed
......@@ -24,6 +24,6 @@ public function logout()
Auth::guard('web')->logout();
}
return redirect('/');
return redirect(route('login'));
}
}
......@@ -3,7 +3,10 @@
use App\Http\Controllers\PdfController;
use App\Http\Controllers\UsersController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\LogoutController;
/*
/*
|--------------------------------------------------------------------------
| Web Routes
......@@ -15,11 +18,11 @@
|
*/
Route::get('/logout', [\App\Http\Controllers\Auth\LogoutController::class, 'logout'])->name('logout');
Route::post('/login', [\App\Http\Controllers\Auth\LoginController::class, 'login'])->name('login');
Route::get('/logout', [LogoutController::class, 'logout'])->name('logout');
Route::post('/login', [LoginController::class, 'login'])->name('login');
Route::get('/login', function () {
if (\Illuminate\Support\Facades\Auth::user()) {
return redirect('/');
if (Auth::user()) {
return redirect(route('home'));
}
return view('app');
......@@ -40,7 +43,7 @@
Route::get('/', function () {
if (!Auth::user()) {
return redirect('/login');
return redirect(route('login'));
}
return view('app');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment