public function generateSlug($title, $useParent = true)
    {
        $slug = $useParent ? $this->fixSlug($this->fixSlug($this->getAttribute('slug')).$this->fixSlug($title)) : $this->fixSlug($title);

        // Make sure it doesn't already exist. Exclude own record if we're not using parent to generate slug
        if ($this->getExistingSlug($slug, ! $useParent)) {
            // It already exists, increment it
            $slug = $this->incrementLatestSlug($slug);
        }

        return $slug;
    }
public function generateSlug($title, $useParent = true)
    {
        $slug = $useParent ? $this->fixSlug($this->fixSlug($this->getAttribute('slug')).$this->fixSlug($title)) : $this->fixSlug($title);

        // Make sure it doesn't already exist. Exclude own record if we're not using parent to generate slug
        if ($this->getExistingSlug($slug, ! $useParent)) {
            // It already exists, increment it
            $slug = $this->incrementLatestSlug($slug);
        }

        return $slug;
    }
public function generateSlug ( $ title , $ useParent = true ) { $ slug = $ useParent ? $ this -> fixSlug ( $ this -> fixSlug ( $ this -> getAttribute ( 'slug' ) ) . $ this -> fixSlug ( $ title ) ) : $ this -> fixSlug ( $ title ) ; // Make sure it doesn't already exist. Exclude own record if we're not using parent to generate slug if ( $ this -> getExistingSlug ( $ slug , ! $ useParent ) ) { // It already exists, increment it $ slug = $ this -> incrementLatestSlug ( $ slug ) ; } return $ slug ; }
Takes a parent tree item and generates a slug based off it.

@param $title
@param $useParent

@return string
Takes a parent tree item and generates a slug based off it .