src/LaratrustServiceProvider.php
protected function registerMiddlewares()
    {
        if (!$this->app['config']->get('laratrust.middleware.register')) {
            return;
        }

        $router = $this->app['router'];

        if (method_exists($router, 'middleware')) {
            $registerMethod = 'middleware';
        } elseif (method_exists($router, 'aliasMiddleware')) {
            $registerMethod = 'aliasMiddleware';
        } else {
            return;
        }

        foreach ($this->middlewares as $key => $class) {
            $router->$registerMethod($key, $class);
        }
    }
protected function registerMiddlewares()
    {
        if (!$this->app['config']->get('laratrust.middleware.register')) {
            return;
        }

        $router = $this->app['router'];

        if (method_exists($router, 'middleware')) {
            $registerMethod = 'middleware';
        } elseif (method_exists($router, 'aliasMiddleware')) {
            $registerMethod = 'aliasMiddleware';
        } else {
            return;
        }

        foreach ($this->middlewares as $key => $class) {
            $router->$registerMethod($key, $class);
        }
    }
protected function registerMiddlewares ( ) { if ( ! $ this -> app [ 'config' ] -> get ( 'laratrust.middleware.register' ) ) { return ; } $ router = $ this -> app [ 'router' ] ; if ( method_exists ( $ router , 'middleware' ) ) { $ registerMethod = 'middleware' ; } elseif ( method_exists ( $ router , 'aliasMiddleware' ) ) { $ registerMethod = 'aliasMiddleware' ; } else { return ; } foreach ( $ this -> middlewares as $ key => $ class ) { $ router -> $ registerMethod ( $ key , $ class ) ; } }
Register the middlewares automatically.

@return void
Register the middlewares automatically .