Kernel.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace App\Http;
  3. use App\Http\Middleware\CheckAuthMiddleware;
  4. use App\Http\Middleware\RequestLogMiddleware;
  5. use App\Http\Middleware\TestMiddleware;
  6. use Illuminate\Foundation\Http\Kernel as HttpKernel;
  7. class Kernel extends HttpKernel
  8. {
  9. /**
  10. * The application's global HTTP middleware stack.
  11. *
  12. * These middleware are run during every request to your application.
  13. *
  14. * @var array
  15. */
  16. protected $middleware = [
  17. \App\Http\Middleware\TrustProxies::class,
  18. \App\Http\Middleware\CheckForMaintenanceMode::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
  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. // 'throttle:60,1',
  40. 'bindings',
  41. "requestLog"
  42. ],
  43. ];
  44. /**
  45. * The application's route middleware.
  46. *
  47. * These middleware may be assigned to groups or used individually.
  48. *
  49. * @var array
  50. */
  51. protected $routeMiddleware = [
  52. 'auth' => \App\Http\Middleware\Authenticate::class,
  53. 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
  54. 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
  55. 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
  56. 'can' => \Illuminate\Auth\Middleware\Authorize::class,
  57. 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
  58. 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
  59. 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
  60. 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
  61. //自定义中间件
  62. "test"=>TestMiddleware::class,
  63. "requestLog"=>RequestLogMiddleware::class,//请求日志中间件
  64. "checkAuth"=>CheckAuthMiddleware::class,//权限校验中间件
  65. ];
  66. /**
  67. * The priority-sorted list of middleware.
  68. *
  69. * This forces non-global middleware to always be in the given order.
  70. *
  71. * @var array
  72. */
  73. protected $middlewarePriority = [
  74. \Illuminate\Session\Middleware\StartSession::class,
  75. \Illuminate\View\Middleware\ShareErrorsFromSession::class,
  76. \App\Http\Middleware\Authenticate::class,
  77. \Illuminate\Session\Middleware\AuthenticateSession::class,
  78. \Illuminate\Routing\Middleware\SubstituteBindings::class,
  79. \Illuminate\Auth\Middleware\Authorize::class,
  80. ];
  81. }