2024-06-09 20:31:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2024-06-09 21:45:57 +00:00
|
|
|
use App\Http\Controllers\RegisterController;
|
2024-06-09 22:03:34 +00:00
|
|
|
use App\Http\Controllers\LoginController;
|
2024-06-09 20:31:11 +00:00
|
|
|
|
|
|
|
Route::get('/', function () {
|
|
|
|
return view('welcome');
|
|
|
|
});
|
2024-06-09 21:45:57 +00:00
|
|
|
|
|
|
|
Route::get('/register', function () {
|
|
|
|
return view('register');
|
|
|
|
});
|
2024-06-09 22:03:34 +00:00
|
|
|
|
|
|
|
Route::post('/register', [RegisterController::class, 'create']);
|
|
|
|
|
|
|
|
Route::get('/login', function () {
|
|
|
|
return view('login');
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::post('/login', [LoginController::class, 'login']);
|
|
|
|
|
|
|
|
Route::get('/logout', function () {
|
|
|
|
auth()->logout();
|
|
|
|
return redirect('/');
|
|
|
|
});
|
|
|
|
|
|
|
|
Route::get('/profile', function () {
|
|
|
|
if (!auth()->check()) {
|
|
|
|
return redirect('/');
|
|
|
|
}
|
|
|
|
return view('profile');
|
|
|
|
});
|