public function controller($uri, $controller, $names = [])
    {
        $arr = explode('\\', $controller);
        $controllerClassName = $arr[  sizeof($arr) -1  ];
        $routable = (new ControllerInspector)->getRoutable($this->addGroupNamespace($controller), $uri);
        foreach ($routable as $method => $routes) {
            if ($method == 'getMethodProperties') {
                continue;
            }

            foreach ($routes as $route) {
//  original code
//                $this->{$route['verb']}($route['uri'], [
//                        'uses' => $controller.'@'.$method,
//                        'as' => array_get($names, $method)
//                ]);
//                Route::{$route['verb']}( $route['uri'] ,  "{$controller}@{$method}" );

// should add middleware support later
                Route::{$route['verb']}( $route['uri'] ,  "{$controllerClassName}@{$method}" );

// middleware support not working as following
//                Route::{$route['verb']}( $route['uri'] ,  [
//                    'uses' => $controller.'@'.$method,
//                    'as' => array_get($names, $method)
//                ]);
            }
        }
    }
public function controller($uri, $controller, $names = [])
    {
        $arr = explode('\\', $controller);
        $controllerClassName = $arr[  sizeof($arr) -1  ];
        $routable = (new ControllerInspector)->getRoutable($this->addGroupNamespace($controller), $uri);
        foreach ($routable as $method => $routes) {
            if ($method == 'getMethodProperties') {
                continue;
            }

            foreach ($routes as $route) {
//  original code
//                $this->{$route['verb']}($route['uri'], [
//                        'uses' => $controller.'@'.$method,
//                        'as' => array_get($names, $method)
//                ]);
//                Route::{$route['verb']}( $route['uri'] ,  "{$controller}@{$method}" );

// should add middleware support later
                Route::{$route['verb']}( $route['uri'] ,  "{$controllerClassName}@{$method}" );

// middleware support not working as following
//                Route::{$route['verb']}( $route['uri'] ,  [
//                    'uses' => $controller.'@'.$method,
//                    'as' => array_get($names, $method)
//                ]);
            }
        }
    }
public function controller ( $ uri , $ controller , $ names = [ ] ) { $ arr = explode ( '\\' , $ controller ) ; $ controllerClassName = $ arr [ sizeof ( $ arr ) - 1 ] ; $ routable = ( new ControllerInspector ) -> getRoutable ( $ this -> addGroupNamespace ( $ controller ) , $ uri ) ; foreach ( $ routable as $ method => $ routes ) { if ( $ method == 'getMethodProperties' ) { continue ; } foreach ( $ routes as $ route ) { //  original code //                $this->{$route['verb']}($route['uri'], [ //                        'uses' => $controller.'@'.$method, //                        'as' => array_get($names, $method) //                ]); //                Route::{$route['verb']}( $route['uri'] ,  "{$controller}@{$method}" ); // should add middleware support later Route :: { $ route [ 'verb' ] } ( $ route [ 'uri' ] , "{$controllerClassName}@{$method}" ) ; // middleware support not working as following //                Route::{$route['verb']}( $route['uri'] ,  [ //                    'uses' => $controller.'@'.$method, //                    'as' => array_get($names, $method) //                ]); } } }
Register a controller.

@param string $uri
@param string $controller
@param array  $names

@return void
Register a controller .