src/_ServiceProvider.php
protected function routeMiddleware($key, $middleware = null, $force = false)
    {
        if ($this->app->runningInConsole() && $force === false) {
            return $this->getRouter();
        }
        if (is_array($key)) {
            foreach ($key as $k => $m) {
                $this->routeMiddleware($k, $m);
            }

            return $this->getRouter();
        } else {
            $this->getRouter()->middleware($key, $middleware);
        }
    }
protected function routeMiddleware($key, $middleware = null, $force = false)
    {
        if ($this->app->runningInConsole() && $force === false) {
            return $this->getRouter();
        }
        if (is_array($key)) {
            foreach ($key as $k => $m) {
                $this->routeMiddleware($k, $m);
            }

            return $this->getRouter();
        } else {
            $this->getRouter()->middleware($key, $middleware);
        }
    }
protected function routeMiddleware ( $ key , $ middleware = null , $ force = false ) { if ( $ this -> app -> runningInConsole ( ) && $ force === false ) { return $ this -> getRouter ( ) ; } if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ m ) { $ this -> routeMiddleware ( $ k , $ m ) ; } return $ this -> getRouter ( ) ; } else { $ this -> getRouter ( ) -> middleware ( $ key , $ middleware ) ; } }
Add a route middleware. Will not be added when running in console.

@param      $key
@param null $middleware
@param bool $force

@return \Illuminate\Contracts\Routing\Registrar|\Illuminate\Routing\Router
Add a route middleware . Will not be added when running in console .