public function transform($slug)
    {
        if (null === $slug) {
            return;
        }

        // If the slug ends with a slash, return just a slash
        // so the item is used as the index page of that directory
        if (substr($slug, -1) == '/') {
            return '/';
        }

        $array = explode('/', $slug);
        $slug = end($array);

        return $slug;
    }
public function transform($slug)
    {
        if (null === $slug) {
            return;
        }

        // If the slug ends with a slash, return just a slash
        // so the item is used as the index page of that directory
        if (substr($slug, -1) == '/') {
            return '/';
        }

        $array = explode('/', $slug);
        $slug = end($array);

        return $slug;
    }
public function transform ( $ slug ) { if ( null === $ slug ) { return ; } // If the slug ends with a slash, return just a slash // so the item is used as the index page of that directory if ( substr ( $ slug , - 1 ) == '/' ) { return '/' ; } $ array = explode ( '/' , $ slug ) ; $ slug = end ( $ array ) ; return $ slug ; }
Removes the directory path from the slug.

@param string $slug

@return string
Removes the directory path from the slug .