visuddhinanda 2 veckor sedan
förälder
incheckning
11918c93a8
1 ändrade filer med 14 tillägg och 2 borttagningar
  1. 14 2
      api-v13/bootstrap/app.php

+ 14 - 2
api-v13/bootstrap/app.php

@@ -8,8 +8,9 @@ use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
 
 return Application::configure(basePath: dirname(__DIR__))
     ->withRouting(
-        web: __DIR__.'/../routes/web.php',
-        commands: __DIR__.'/../routes/console.php',
+        web: __DIR__ . '/../routes/web.php',
+        api: __DIR__ . '/../routes/api.php',
+        commands: __DIR__ . '/../routes/console.php',
         health: '/up',
     )
     ->withMiddleware(function (Middleware $middleware): void {
@@ -17,6 +18,17 @@ return Application::configure(basePath: dirname(__DIR__))
             HandleInertiaRequests::class,
             AddLinkHeadersForPreloadedAssets::class,
         ]);
+
+        // API 组中间件(来自原 Laravel 8 Kernel)
+        $middleware->api(append: [
+            \App\Http\Middleware\ApiLog::class,
+            \App\Http\Middleware\UserOperation::class,
+        ]);
+
+        // web 组中间件
+        $middleware->web(append: [
+            \App\Http\Middleware\SetLocale::class,
+        ]);
     })
     ->withExceptions(function (Exceptions $exceptions): void {
         //