protected function generateTableName($class)
    {
        // datamapper namespace tables
        if ($this->namespaceTablenames) {
            $className = array_slice(explode('/', str_replace('\\', '/', $class)), 2);

            // delete last entry if entry is equal to the next to last entry
            if (count($className) >= 2 && end($className) == prev($className)) {
                array_pop($className);
            }

            $classBasename = array_pop($className);

            return strtolower(implode('_', array_merge($className, preg_split('/(?<=\\w)(?=[A-Z])/', $classBasename))));
        }

        // eloquent default
        return str_replace('\\', '', snake_case(str_plural(class_basename($class))));
    }