public function dispatch($action = [], $group = null)
    {

        // convert string type to array
        if (is_string($action)) {
            $action = [
                '_controller' => $action
            ];
        }


        // find and register route group
        $this->registerGroup($group, $action);

        // find and run middleware
        if ($middleware = $this->findMiddleware($action)) {
            app()->call([$this, 'middleware'], $middleware);
        }

        if (is_array($action)) {

            list($controller, $method, $namespace) = $this->findControllerAndMethod($action);

            // register the namespace
            isset($namespace) ? $this->setNamespace($namespace) : null;

            // create a controller instance
            $controller = $this->createControllerInstance($controller);

            // call the method
            $response = $this->callControllerMethod($controller, $method);
            return $this->handleResponse($response);

        } elseif ($action instanceof Closure) {
            return $this->handleResponse(app()->call($action, ParameterBag::getParameters()));
        } else {
            return false;
        }
    }
public function dispatch($action = [], $group = null)
    {

        // convert string type to array
        if (is_string($action)) {
            $action = [
                '_controller' => $action
            ];
        }


        // find and register route group
        $this->registerGroup($group, $action);

        // find and run middleware
        if ($middleware = $this->findMiddleware($action)) {
            app()->call([$this, 'middleware'], $middleware);
        }

        if (is_array($action)) {

            list($controller, $method, $namespace) = $this->findControllerAndMethod($action);

            // register the namespace
            isset($namespace) ? $this->setNamespace($namespace) : null;

            // create a controller instance
            $controller = $this->createControllerInstance($controller);

            // call the method
            $response = $this->callControllerMethod($controller, $method);
            return $this->handleResponse($response);

        } elseif ($action instanceof Closure) {
            return $this->handleResponse(app()->call($action, ParameterBag::getParameters()));
        } else {
            return false;
        }
    }
public function dispatch ( $ action = [ ] , $ group = null ) { // convert string type to array if ( is_string ( $ action ) ) { $ action = [ '_controller' => $ action ] ; } // find and register route group $ this -> registerGroup ( $ group , $ action ) ; // find and run middleware if ( $ middleware = $ this -> findMiddleware ( $ action ) ) { app ( ) -> call ( [ $ this , 'middleware' ] , $ middleware ) ; } if ( is_array ( $ action ) ) { list ( $ controller , $ method , $ namespace ) = $ this -> findControllerAndMethod ( $ action ) ; // register the namespace isset ( $ namespace ) ? $ this -> setNamespace ( $ namespace ) : null ; // create a controller instance $ controller = $ this -> createControllerInstance ( $ controller ) ; // call the method $ response = $ this -> callControllerMethod ( $ controller , $ method ) ; return $ this -> handleResponse ( $ response ) ; } elseif ( $ action instanceof Closure ) { return $ this -> handleResponse ( app ( ) -> call ( $ action , ParameterBag :: getParameters ( ) ) ) ; } else { return false ; } }
Dispatch a action from array

@param array|string $action
@param array|null $group
@return mixed
Dispatch a action from array