Files
budget_analyser/routes/web.php
2024-01-27 10:32:55 +01:00

34 lines
1.1 KiB
PHP

<?php
use App\Http\Controllers\TransactionsController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/login', function () {
if (Auth::check()){return redirect('/');}
return Inertia::render('Auth/login');
})->name('login');
Route::post('/login', [UserController::class, 'login']);
Route::middleware(['auth'])->group(function(){
Route::get('/', function () {
return view('welcome');
})->name('home');
Route::get('/profile', function () {
return Inertia::render('User/profile');
})->name('profile');
Route::get('/transactions', [TransactionsController::class, 'index'])->name('transactions');
});