src/Gzero/Core/Models/Route.php
public static function buildUniquePath($path, $languageCode)
    {
        $count = self::query()
            ->where('language_code', $languageCode)
            ->whereRaw("path ~ '^$path($|-[0-9]+$)'")
            ->count();

        return ($count) ? $path . '-' . $count : $path;
    }
public static function buildUniquePath($path, $languageCode)
    {
        $count = self::query()
            ->where('language_code', $languageCode)
            ->whereRaw("path ~ '^$path($|-[0-9]+$)'")
            ->count();

        return ($count) ? $path . '-' . $count : $path;
    }
public static function buildUniquePath ( $ path , $ languageCode ) { $ count = self :: query ( ) -> where ( 'language_code' , $ languageCode ) -> whereRaw ( "path ~ '^$path($|-[0-9]+$)'" ) -> count ( ) ; return ( $ count ) ? $ path . '-' . $ count : $ path ; }
Function returns an unique path address from given path in specific language

@param string $path         string path address to search for
@param string $languageCode translation language code

@return string an unique path address
Function returns an unique path address from given path in specific language