private function makeSlugUnique($slug)
    {
        $slug = str_slug($slug);

        // check updating
        $slugUpdate = $this->checkUpdatingSlug($slug);

        if ($slugUpdate !== false) {
            return $slugUpdate;
        }

        // get existing slugs
        $list = $this->getExistingSlugs($slug);

        if ($list->count() === 0) {
            return $slug;
        }

        // generate unique suffix
        return $this->generateSuffix($slug, $list);
    }
private function makeSlugUnique($slug)
    {
        $slug = str_slug($slug);

        // check updating
        $slugUpdate = $this->checkUpdatingSlug($slug);

        if ($slugUpdate !== false) {
            return $slugUpdate;
        }

        // get existing slugs
        $list = $this->getExistingSlugs($slug);

        if ($list->count() === 0) {
            return $slug;
        }

        // generate unique suffix
        return $this->generateSuffix($slug, $list);
    }
private function makeSlugUnique ( $ slug ) { $ slug = str_slug ( $ slug ) ; // check updating $ slugUpdate = $ this -> checkUpdatingSlug ( $ slug ) ; if ( $ slugUpdate !== false ) { return $ slugUpdate ; } // get existing slugs $ list = $ this -> getExistingSlugs ( $ slug ) ; if ( $ list -> count ( ) === 0 ) { return $ slug ; } // generate unique suffix return $ this -> generateSuffix ( $ slug , $ list ) ; }
Make Slug Unique in same table
@param $slug
@return string
Make Slug Unique in same table