-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb.php
executable file
·89 lines (75 loc) · 2.66 KB
/
web.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
use App\Livewire\Library;
use App\Livewire\LibraryAsset;
use App\Livewire\LoginForm;
use App\Livewire\LlmClient;
use App\Livewire\RegisterForm;
use App\Livewire\RemoteLibrary;
use App\Livewire\Vault;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Ramsey\Uuid\Uuid;
/*
|--------------------------------------------------------------------------
| 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('/', function () {
return redirect(route('remote-library'));
})
->name('home')
->middleware('auth:sanctum');
Route::get('create-chat', function () {
$user = auth()->user();
$chat = $user->chats()->create([
'uuid' => Uuid::uuid4()->toString(),
'name' => fake()->company,
]);
return redirect(route('chat', [
'chat' => $chat->uuid,
]));
})
->name('new-chat')
->middleware('auth:sanctum');
// =============================================================================
// Auth
// =============================================================================
// Route::get('login', LoginForm::class)->name('login');
Route::get('login', function() {
auth()->loginUsingId(1);
return redirect(route('home'));
})->name('login');
Route::get('logout', function () {
Auth::logout();
return redirect(route('login'));
})->name('logout');
Route::get('register', RegisterForm::class)->name('register');
// =============================================================================
// Chat
// =============================================================================
Route::get('/chat/{chat}', LlmClient::class)
->middleware('auth:sanctum')
->name('chat');
// =============================================================================
// Remote Library
// =============================================================================
Route::get('/remote-library', RemoteLibrary::class)
->middleware('auth:sanctum')
->name('remote-library');
Route::get('/vault/{vault}', Vault::class)
->middleware('auth:sanctum')
->name('vault');
// =============================================================================
// Library
// =============================================================================
Route::get('/library', Library::class)
->middleware('auth:sanctum')
->name('library');
Route::get('/library/{asset}', LibraryAsset::class)
->middleware('auth:sanctum')
->name('library-asset');