feat: add user authentication with livewire components
This commit is contained in:
+27
-7
@@ -1,19 +1,39 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Chatbot;
|
||||
use App\Livewire\Auth\Login;
|
||||
use App\Livewire\Auth\Register;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
// Global console / Chatbot manager
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
// Guest routes
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('/login', Login::class)->name('login');
|
||||
Route::get('/register', Register::class)->name('register');
|
||||
});
|
||||
|
||||
// Admin dashboard for a specific chatbot
|
||||
Route::get('/admin/chatbots/{chatbot:slug}', function (Chatbot $chatbot) {
|
||||
return view('chatbot-admin', compact('chatbot'));
|
||||
// Logout route
|
||||
Route::any('/logout', function () {
|
||||
Auth::logout();
|
||||
request()->session()->invalidate();
|
||||
request()->session()->regenerateToken();
|
||||
return redirect('/login');
|
||||
})->name('logout');
|
||||
|
||||
// Authenticated administration routes
|
||||
Route::middleware('auth')->group(function () {
|
||||
// Global console / Chatbot manager
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
// Admin dashboard for a specific chatbot
|
||||
Route::get('/admin/chatbots/{chatbot:slug}', function (Chatbot $chatbot) {
|
||||
return view('chatbot-admin', compact('chatbot'));
|
||||
});
|
||||
});
|
||||
|
||||
// Full page demo testing for a specific chatbot
|
||||
// Full page demo testing for a specific chatbot (Public/Private as per requirement)
|
||||
Route::get('/chatbot/{chatbot:slug}', function (Chatbot $chatbot) {
|
||||
return view('chatbot-demo', compact('chatbot'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user