Kernel.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace App\Http;
  3. use App\Http\Middleware\AdminApiAuthMiddleware;
  4. use Illuminate\Foundation\Http\Kernel as HttpKernel;
  5. class Kernel extends HttpKernel
  6. {
  7. /**
  8. * The application's global HTTP middleware stack.
  9. *
  10. * These middleware are run during every request to your application.
  11. *
  12. * @var array<int, class-string|string>
  13. */
  14. protected $middleware = [
  15. // \App\Http\Middleware\TrustHosts::class,
  16. \App\Http\Middleware\TrustProxies::class,
  17. \Fruitcake\Cors\HandleCors::class,
  18. \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
  19. \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
  20. \App\Http\Middleware\TrimStrings::class,
  21. \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
  22. ];
  23. /**
  24. * The application's route middleware groups.
  25. *
  26. * @var array<string, array<int, class-string|string>>
  27. */
  28. protected $middlewareGroups = [
  29. 'web' => [
  30. \App\Http\Middleware\EncryptCookies::class,
  31. \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
  32. \Illuminate\Session\Middleware\StartSession::class,
  33. // \Illuminate\Session\Middleware\AuthenticateSession::class,
  34. \Illuminate\View\Middleware\ShareErrorsFromSession::class,
  35. \App\Http\Middleware\VerifyCsrfToken::class,
  36. \Illuminate\Routing\Middleware\SubstituteBindings::class,
  37. ],
  38. 'api' => [
  39. // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
  40. 'throttle:api',
  41. \Illuminate\Routing\Middleware\SubstituteBindings::class,
  42. ],
  43. //前端验证
  44. 'api_verify'=>[],
  45. //后台验证
  46. 'adminApi_verify'=>[
  47. AdminApiAuthMiddleware::class
  48. ],
  49. ];
  50. /**
  51. * The application's route middleware.
  52. *
  53. * These middleware may be assigned to groups or used individually.
  54. *
  55. * @var array<string, class-string|string>
  56. */
  57. protected $routeMiddleware = [
  58. 'auth' => \App\Http\Middleware\Authenticate::class,
  59. 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
  60. 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
  61. 'can' => \Illuminate\Auth\Middleware\Authorize::class,
  62. 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
  63. 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
  64. 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
  65. 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
  66. 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
  67. ];
  68. }