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;
    }
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;
    }
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 ; }
Get the controller name, separated as necessary and with or without namespaces.

@param  string  $separator
@param  bool    $includeNamespace
@param  string  $trimNamespace
@return string|null
Get the controller name separated as necessary and with or without namespaces .