public function controller($separator = null, $includeNamespace = true, $trimNamespace = 'App\Http\Controllers\\')
    {
        if ($action = $this->router->currentRouteAction()) {
            $separator = is_null($separator) ? ' ' : $separator;

            $controller = head(Str::parseCallback($action, null));

            // If the controller contains the given namespace, remove it.
            if (substr($controller, 0, strlen($trimNamespace)) === $trimNamespace) {
                $controller = substr($controller, strlen($trimNamespace));
            }

            // If the controller contains 'Controller' at the end, remove it.
            if (substr($controller, - strlen('Controller')) === 'Controller') {
                $controller = substr($controller, 0, - strlen('Controller'));
            }

            // Separate out nested controller resources.
            $controller = str_replace('_', $separator, snake_case($controller));

            // Either separate out the namespaces or remove them.
            $controller = $includeNamespace ? str_replace('\\', null, $controller) : substr(strrchr($controller, '\\'), 1);

            return trim($controller);
        }

        return null;
    }