Ejemplo n.º 1
0
 /**
  * Register the middleware.
  *
  * @return void
  */
 protected function registerMiddleware()
 {
     $this->app->singleton(Request::class, function ($app) {
         $middleware = new Middleware\Request($app, $app[ExceptionHandler::class], $app[Router::class], $app[RequestValidator::class], $app['events']);
         $middleware->setMiddlewares($this->config('middleware', false));
         return $middleware;
     });
     $this->app->singleton(AuthMiddleware::class, function ($app) {
         return new Middleware\Auth($app[Router::class], $app[Auth::class]);
     });
     $this->app->singleton(RateLimit::class, function ($app) {
         return new Middleware\RateLimit($app[Router::class], $app[Handler::class]);
     });
     $this->app->singleton(PrepareController::class, function ($app) {
         return new Middleware\PrepareController($app[Router::class]);
     });
 }
Ejemplo n.º 2
0
 /**
  * Register the middleware.
  *
  * @return void
  */
 protected function registerMiddleware()
 {
     $this->app->singleton('Dingo\\Api\\Http\\Middleware\\Request', function ($app) {
         $middleware = new Middleware\Request($app, $app['Dingo\\Api\\Contract\\Debug\\ExceptionHandler'], $app['Dingo\\Api\\Routing\\Router'], $app['Dingo\\Api\\Http\\RequestValidator'], $app['events']);
         $middleware->setMiddlewares($this->config('middleware', false));
         return $middleware;
     });
     $this->app->singleton('Dingo\\Api\\Http\\Middleware\\Auth', function ($app) {
         return new Middleware\Auth($app['Dingo\\Api\\Routing\\Router'], $app['Dingo\\Api\\Auth\\Auth']);
     });
     $this->app->singleton('Dingo\\Api\\Http\\Middleware\\RateLimit', function ($app) {
         return new Middleware\RateLimit($app['Dingo\\Api\\Routing\\Router'], $app['Dingo\\Api\\Http\\RateLimit\\Handler']);
     });
     $this->app->singleton('Dingo\\Api\\Http\\Middleware\\PrepareController', function ($app) {
         return new Middleware\PrepareController($app['Dingo\\Api\\Routing\\Router']);
     });
 }