parent
377b0600f8
commit
bfd4197fc4
4 changed files with 50 additions and 14 deletions
@ -0,0 +1,26 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Providers; |
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route; |
||||||
|
use Illuminate\Support\ServiceProvider; |
||||||
|
|
||||||
|
class AuthRouteServiceProvider extends ServiceProvider |
||||||
|
{ |
||||||
|
/** |
||||||
|
* Register services. |
||||||
|
*/ |
||||||
|
public function register(): void |
||||||
|
{ |
||||||
|
// |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Bootstrap services. |
||||||
|
*/ |
||||||
|
public function boot(): void |
||||||
|
{ |
||||||
|
Route::middleware('web') |
||||||
|
->group(base_path('routes/auth.php')); |
||||||
|
} |
||||||
|
} |
@ -1,7 +1,8 @@ |
|||||||
<?php |
<?php |
||||||
// List of service providers to be registered by the application |
|
||||||
return [ |
return [ |
||||||
App\Providers\AppServiceProvider::class, |
App\Providers\AppServiceProvider::class, |
||||||
|
App\Providers\AuthRouteServiceProvider::class, |
||||||
App\Providers\AuthServiceProvider::class, |
App\Providers\AuthServiceProvider::class, |
||||||
App\Providers\MiddlewareServiceProvider::class, |
App\Providers\MiddlewareServiceProvider::class, |
||||||
]; |
]; |
||||||
|
@ -0,0 +1,22 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
use App\Http\Controllers\Auth\LoginController; |
||||||
|
use Illuminate\Support\Facades\Route; |
||||||
|
use App\Livewire\Dashboard; |
||||||
|
|
||||||
|
// Login form routes for guests only |
||||||
|
Route::middleware('guest')->group(function () { |
||||||
|
Route::get('login', [LoginController::class, 'showLoginForm']) |
||||||
|
->name('login'); |
||||||
|
Route::post('login', [LoginController::class, 'login']); |
||||||
|
}); |
||||||
|
|
||||||
|
// Logout route for authenticated users only |
||||||
|
Route::post('logout', [LoginController::class, 'logout']) |
||||||
|
->middleware('auth') |
||||||
|
->name('logout'); |
||||||
|
|
||||||
|
// Dashboard route (Livewire) for authenticated users only |
||||||
|
Route::get('dashboard', Dashboard::class) |
||||||
|
->middleware('auth') |
||||||
|
->name('dashboard'); |
Loading…
Reference in new issue