31 lines
1005 B
PHP
31 lines
1005 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Http\Controllers\Auth\SocialiteController;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Inertia\Inertia;
|
|
|
|
Route::get('/', fn () => Inertia::render('Landing'))->name('landing');
|
|
|
|
// Authentication routes
|
|
Route::get('/login', [SocialiteController::class, 'redirect'])->name('login');
|
|
Route::get('/auth/callback', [SocialiteController::class, 'callback']);
|
|
Route::post('/logout', [SocialiteController::class, 'logout'])->name('logout')->middleware('auth');
|
|
|
|
// Dev auto-login route
|
|
if (app()->environment('local', 'testing')) {
|
|
Route::get('/login-jonathan', function () {
|
|
$user = \App\Models\User::where('email', 'jonathan@blijnder.nl')->first();
|
|
|
|
if (! $user) {
|
|
\Illuminate\Support\Facades\Artisan::call('db:seed', ['--class' => 'Database\\Seeders\\JonathanSeeder']);
|
|
$user = \App\Models\User::where('email', 'jonathan@blijnder.nl')->first();
|
|
}
|
|
|
|
auth()->login($user);
|
|
|
|
return redirect('/');
|
|
});
|
|
}
|