private function generateSuffix($slug, $list)
    {
        // loop through list and get highest index number
        $index = $list->map(function ($s) use ($slug) {
            // str_replace instead of explode('-');
            return intval(str_replace($slug . '-', '', $s));
        })->sort()->last();

        return $slug . '-' . ($index + 1);
    }
private function generateSuffix($slug, $list)
    {
        // loop through list and get highest index number
        $index = $list->map(function ($s) use ($slug) {
            // str_replace instead of explode('-');
            return intval(str_replace($slug . '-', '', $s));
        })->sort()->last();

        return $slug . '-' . ($index + 1);
    }
private function generateSuffix ( $ slug , $ list ) { // loop through list and get highest index number $ index = $ list -> map ( function ( $ s ) use ( $ slug ) { // str_replace instead of explode('-'); return intval ( str_replace ( $ slug . '-' , '' , $ s ) ) ; } ) -> sort ( ) -> last ( ) ; return $ slug . '-' . ( $ index + 1 ) ; }
Suffix unique index to slug

@param $slug
@param $list
@return string
Suffix unique index to slug