2026-02-26 12:02:00 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Application;
|
|
|
|
|
use Illuminate\Foundation\Configuration\Exceptions;
|
|
|
|
|
use Illuminate\Foundation\Configuration\Middleware;
|
|
|
|
|
|
|
|
|
|
return Application::configure(basePath: dirname(__DIR__))
|
|
|
|
|
->withRouting(
|
|
|
|
|
web: __DIR__.'/../routes/web.php',
|
|
|
|
|
commands: __DIR__.'/../routes/console.php',
|
|
|
|
|
channels: __DIR__.'/../routes/channels.php',
|
|
|
|
|
health: '/up',
|
|
|
|
|
)
|
2026-02-26 13:35:38 +08:00
|
|
|
->withMiddleware(function (Middleware $middleware) {
|
|
|
|
|
$middleware->alias([
|
|
|
|
|
'chat.auth' => \App\Http\Middleware\ChatAuthenticate::class,
|
|
|
|
|
'chat.level' => \App\Http\Middleware\LevelRequired::class,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// 这一步是为了防止用户访问需要登录的页面时,默认被跳到原版 Laravel 未定义的 login 路由报错
|
|
|
|
|
$middleware->redirectGuestsTo('/');
|
2026-02-26 12:02:00 +08:00
|
|
|
})
|
|
|
|
|
->withExceptions(function (Exceptions $exceptions): void {
|
|
|
|
|
//
|
|
|
|
|
})->create();
|