Skip to content

Commit

Permalink
Web > User Logout işlemi için GET metodu eklendi.
Browse files Browse the repository at this point in the history
  • Loading branch information
berkanumutlu committed Jul 27, 2024
1 parent 30e8f5d commit 1ef6fb9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions project/app/Http/Controllers/Web/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ public function logout(): \Illuminate\Http\JsonResponse
}
return response()->json($response);
}

public function logout_get()
{
if (Auth::guard('web')->check()) {
try {
Auth::guard('web')->logout();
//$request->session()->invalidate();
//$request->session()->regenerate();
} catch (\Exception $e) {
//TODO: Hata log düşülebilir.
}
}
return response()->redirect()->back();
}
}
1 change: 1 addition & 0 deletions project/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Route::get('login', "index")->name('index');
Route::post('login', "login");
});
Route::get('logout', [\App\Http\Controllers\Web\LoginController::class, "logout_get"])->name('logout');
Route::post('logout', [\App\Http\Controllers\Web\LoginController::class, "logout"])->name('logout');
Route::name('register.')->controller('\App\Http\Controllers\Web\RegisterController')->middleware('guest:web')->group(function () {
Route::get('register', "index")->name('index');
Expand Down

0 comments on commit 1ef6fb9

Please sign in to comment.