init commit
This commit is contained in:
commit
c9d982669a
461 changed files with 30317 additions and 0 deletions
13
routes/api.php
Normal file
13
routes/api.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\CompetitionController;
|
||||
|
||||
Route::get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
})->middleware('auth:api');
|
||||
|
||||
Route::get('/competitions/public', [CompetitionController::class, 'getPublicCompetitions']);
|
||||
|
||||
Route::get('/competitions/user', [CompetitionController::class, 'getUserCompetitions'])->middleware('auth:api');
|
50
routes/auth.php
Normal file
50
routes/auth.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Auth\AuthenticatedSessionController;
|
||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('register', [RegisteredUserController::class, 'create'])
|
||||
->name('register');
|
||||
|
||||
Route::post('register', [RegisteredUserController::class, 'store']);
|
||||
|
||||
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
||||
->name('login');
|
||||
|
||||
Route::post('login', [AuthenticatedSessionController::class, 'store']);
|
||||
});
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
|
||||
->name('logout');
|
||||
});
|
||||
|
||||
Route::get('/auth/redirect', function () {
|
||||
return Socialite::driver('keycloak')->redirect();
|
||||
})->name('auth.redirect');
|
||||
|
||||
Route::get('/auth/callback', function () {
|
||||
$keycloackUser = Socialite::driver('keycloak')->user();
|
||||
|
||||
$user = User::where('oidc_id', $keycloackUser->getId())->first();
|
||||
|
||||
if ($user) {
|
||||
Auth::login($user);
|
||||
return redirect()->intended(route('home'));
|
||||
} else {
|
||||
$user = User::create([
|
||||
'email' => $keycloackUser->getEmail(),
|
||||
'name' => $keycloackUser->getNickname(),
|
||||
'avatar' => $keycloackUser->getAvatar(),
|
||||
'oidc_id' => $keycloackUser->getId()
|
||||
]);
|
||||
Auth::login($user);
|
||||
return redirect()->intended(route('home'));
|
||||
}
|
||||
});
|
8
routes/console.php
Normal file
8
routes/console.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
27
routes/settings.php
Normal file
27
routes/settings.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Settings\PasswordController;
|
||||
use App\Http\Controllers\Settings\ProfileController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inertia\Inertia;
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::redirect('settings', '/settings/profile');
|
||||
|
||||
Route::get('settings/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::patch('settings/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||
Route::delete('settings/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||
|
||||
Route::get('settings/password', [PasswordController::class, 'edit'])->name('password.edit');
|
||||
Route::put('settings/password', [PasswordController::class, 'update'])->name('password.update');
|
||||
|
||||
Route::get('settings/appearance', function () {
|
||||
return Inertia::render('settings/Appearance');
|
||||
})->name('appearance');
|
||||
|
||||
Route::get('settings/permissions', function () {
|
||||
return Inertia::render('settings/Permissions');
|
||||
})->name('permissions');
|
||||
|
||||
Route::get('settings/roles', [ProfileController::class, 'show'])->name('roles');
|
||||
});
|
18
routes/web.php
Normal file
18
routes/web.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\CompetitionController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Inertia\Inertia;
|
||||
|
||||
Route::get('/', function () {
|
||||
return Inertia::render('Home', [
|
||||
'publicTournaments' => Inertia::defer(fn() => CompetitionController::getPublicCompetitions(1, 10))
|
||||
]);
|
||||
})->name('home');
|
||||
|
||||
Route::get('dashboard', function () {
|
||||
return Inertia::render('Dashboard');
|
||||
})->middleware(['auth', 'verified'])->name('dashboard');
|
||||
|
||||
require __DIR__ . '/settings.php';
|
||||
require __DIR__ . '/auth.php';
|
Loading…
Add table
Add a link
Reference in a new issue