I'm using https://github.com/nWidart/laravel-modules to create a module based application in laravel. One module Gateway is planned to use as API Gateway between other REST API. This module is highly inspired by https://github.com/PoweredLocal/vrata.
A middleware HelperMiddleware is created:
public function handle(Request $request /* custom request */, Closure $next, $id)
{
$request->attachRoute(
app()->make(RouteRegistry::class)->getRoute($id)
);
return $next($request);
}
Registered this middleware via ServiceProvider in the module:
$router = $this->app['router'];
$router->aliasMiddleware('gateway', HelperMiddleware::class);
And I tried to add this middleware in route but the middleware is not working.
Please help me resolving this issue. Code: https://github.com/itsursujit/blog
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire