Register the middleware.

@return void
555690
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]);
        });
    }
470498
public function register()
    {
        //Config
        $this->app->singleton(CoreConfig::class, function ($app) {
            return new CoreConfig();
        });

        //Facade
        $this->app->alias(CoreService::class, 'core-service');
    }
1184891
protected function registerHttpMiddlewares()
    {
        // retry
        $this->pushMiddleware($this->retryMiddleware(), 'retry');
        // access token
        $this->pushMiddleware($this->accessTokenMiddleware(), 'access_token');
        // log
        $this->pushMiddleware($this->logMiddleware(), 'log');
    }
93836
protected static function register()
	{
		Route::group(['prefix' => static::$prefix, 'middleware' => static::$middleware, 'namespace' => static::$namespace], function()
		{
			// Show User account overview.
			Route::get('/', 'ShowOverview\Responder')->name('account.overview');

			// Show edit User account form.
			Route::get('edit', 'ShowEdit\Responder')->name('account.edit');

			// Update a User account.
			Route::put('edit', 'Update\Responder')->name('account.update');
		});
	}
423760
private function registerRoutesAndMiddlewares()
    {
        /**
         * @var Router $router
         */
        $router = $this->app[ 'router' ];

        $router->middlewareGroup( 'admin', [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            ArboryAdminHasAllowedIpMiddleware::class
        ] );

        $router->aliasMiddleware( 'arbory.admin_auth', ArboryAdminAuthMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_module_access', ArboryAdminModuleAccessMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_quest', ArboryAdminGuestMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_in_role', ArboryAdminInRoleMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_has_access', ArboryAdminHasAccessMiddleware::class );
        $router->aliasMiddleware( 'arbory.route_redirect', ArboryRouteRedirectMiddleware::class );
        $router->aliasMiddleware( 'arbory.admin_has_allowed_ip', ArboryAdminHasAllowedIpMiddleware::class );

        $this->app->booted( function( $app )
        {
            $app[ Kernel::class ]->prependMiddleware( ArboryRouteRedirectMiddleware::class );
        } );

        $this->registerAdminRoutes();
        $this->registerAppRoutes();
    }
1120539
public function register()
    {
        $this->loadAdminAuthConfig();

        $this->registerRouteMiddleware();

        $this->commands($this->commands);

        $this->mergeConfigFrom(__DIR__.'/../config/terminal.php', 'terminal');

        $this->app->singleton(TerminalApplication::class, function ($app) {
            $config = $app['config']['terminal'];
            $artisan = new TerminalApplication($app, $app['events'], $app->version());
            $artisan->resolveCommands($config['commands']);

            return $artisan;
        });

        $this->app->singleton(Kernel::class, function ($app) {
            $config = $app['config']['terminal'];

            return new Kernel($app[TerminalApplication::class], array_merge($config, [
                'basePath' => base_path(),
                //'basePath' => cookie('cd_base_path'),
                'environment' => $app->environment(),
                'version' => $app->version(),
                'endpoint' => $app['url']->route('terminal.endpoint'),
            ]));
        });
    }
594311
public function register()
    {
        $this->app->singleton(Dispatcher::class, function ($app) {
            return new Dispatcher($app, function ($connection = null) use ($app) {
                return $app[QueueFactoryContract::class]->connection($connection);
            });
        });

        $this->app->alias(
            Dispatcher::class, DispatcherContract::class
        );

        $this->app->alias(
            Dispatcher::class, QueueingDispatcherContract::class
        );
    }
1325140
public function register()
    {
        $this->app['events'] = $this->app->share(function($app)
        {
            return with(new Dispatcher($app))->setQueueResolver(function () use ($app)
            {
                return $app['queue'];
            });
        });
    }
1367933
public function register()
    {
        $this->app->bind(Proxy::class, function($app) {
            return new Proxy($app['config']->all());
        });

        $this->commands(
            Cmd\Backup::class
        );
    }
1255972
public static function register($middleware)
    {
        $config = Container::get('config')->get('middleware');

        if (isset($config[$middleware])) {
            if (in_array($middleware, array_values(self::$middlewares))) {
                throw new ConfigException('middleware has already registered');
            }

            array_push(self::$middlewares, $middleware);
            $middlewares = $config[$middleware];

            if (!is_array($middlewares)) {
                throw new ConfigException('middleware config must be an array');
            }

            foreach ($middlewares as $className) {
                if (!class_exists($className)) {
                    throw new NotFoundException('middleware class ' . $className . ' is not found');
                }

                $class = new $className;
                if (!method_exists($class, 'handle')) {
                    throw new NotFoundException('middleware class should implement a handle() method');
                }

                $class->handle(Container::get('request'), Container::get('response'));
            }
        }
    }
481880
public function register()
    {
        $this->registerRouter();

        $this->registerUrlGenerator();

        $this->registerRedirector();

        $this->registerResponseFactory();

        $this->registerControllerDispatcher();
    }
1003227
public function register()
    {
        $request          = app('request');
        $trustedHeaderSet = config('proxy.headerSet', Request::HEADER_X_FORWARDED_ALL);
        $proxies          = config('proxy.trusted');

        if (!empty($proxies)) {
            if ($proxies === '*') {
                $proxies = [$request->getClientIp()];
            } elseif (!is_array($proxies)) {
                $proxies = [$proxies];
            }
            $request->setTrustedProxies($proxies, $trustedHeaderSet);
        }
    }
424525
public function register()
    {
        $this->app->singleton(Dispatcher::class, function (Container $app) {
            return new Dispatcher($app, function ($connection = null) use ($app) {
                return $app->make(Factory::class)->connection($connection);
            });
        });

        $this->app->alias(Dispatcher::class, DispatcherContract::class);
        $this->app->alias(Dispatcher::class, QueueingDispatcherContract::class);
    }
117508
public function register()
    {
        $this->app->resolving('db', function ($db) {
            $db->extend('rethinkdb', function ($config) {
                return new Connection($config);
            });
        });

        $this->app->singleton('command.rethink-migrate.make', function ($app) {

            $creator = new MigrationCreator($app['files']);
            $composer = $app['composer'];

            return new MigrateMakeCommand($creator, $composer);
        });

        $this->commands('command.rethink-migrate.make');

        $this->app->singleton('command.rethink-model.make', function ($app) {
            return new ModelMakeCommand($app['files']);
        });

        $this->commands('command.rethink-model.make');
    }
1239444
protected function registerMiddleware()
    {
        if ($this->isLumen()) {
            $this->app->routeMiddleware($this->middlewareAliases);
        } else {
            $this->aliasMiddleware();
        }
    }
570921
public function register()
    {
        $this->mergeConfigFrom(__DIR__ . '/config/session_fallback.php', 'session_fallback');

        $this->app->singleton('session', function ($app) {
            return new SessionFallback($app);
        });

        $this->registerSessionDriver();

        $this->app->singleton('Illuminate\Session\Middleware\StartSession');
    }
1158573
protected function registerHttpMiddleware()
    {
        // log
        $this->getHttp()->addMiddleware($this->logMiddleware());
        // retry
        $this->getHttp()->addMiddleware($this->retryMiddleware());
    }