我创建了一个中间件App\Http\Modules\Post\Middleware\Post.php
,我想在服务提供商的app/Http/Kernel.php
的routeMiddleware中添加它。我怎么能做到这一点?
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class
];
我用Google搜索并尝试了prependMiddleware
,但这是针对全球中间件的吗?