protected function generatePivotTablename($class1, $class2, $inverse, $morph=null)
    {
        // datamapper namespace tables
        if ($this->namespaceTablenames) {
            $base = ($inverse)
                ? $this->generateTableName($class1, true)
                : $this->generateTableName($class2, true);

            $related = (! empty($morph))
                ? $morph
                : (! empty($inverse)
                    ? snake_case(class_basename($class2))
                    : snake_case(class_basename($class1)));

            return $base . '_' . $related . '_pivot';
        }

        // eloquent default
        $base = snake_case(class_basename($class1));

        $related = snake_case(class_basename($class2));

        $models = array($related, $base);

        sort($models);

        return strtolower(implode('_', $models));
    }
protected function generatePivotTablename($class1, $class2, $inverse, $morph=null)
    {
        // datamapper namespace tables
        if ($this->namespaceTablenames) {
            $base = ($inverse)
                ? $this->generateTableName($class1, true)
                : $this->generateTableName($class2, true);

            $related = (! empty($morph))
                ? $morph
                : (! empty($inverse)
                    ? snake_case(class_basename($class2))
                    : snake_case(class_basename($class1)));

            return $base . '_' . $related . '_pivot';
        }

        // eloquent default
        $base = snake_case(class_basename($class1));

        $related = snake_case(class_basename($class2));

        $models = array($related, $base);

        sort($models);

        return strtolower(implode('_', $models));
    }
protected function generatePivotTablename ( $ class1 , $ class2 , $ inverse , $ morph = null ) { // datamapper namespace tables if ( $ this -> namespaceTablenames ) { $ base = ( $ inverse ) ? $ this -> generateTableName ( $ class1 , true ) : $ this -> generateTableName ( $ class2 , true ) ; $ related = ( ! empty ( $ morph ) ) ? $ morph : ( ! empty ( $ inverse ) ? snake_case ( class_basename ( $ class2 ) ) : snake_case ( class_basename ( $ class1 ) ) ) ; return $ base . '_' . $ related . '_pivot' ; } // eloquent default $ base = snake_case ( class_basename ( $ class1 ) ) ; $ related = snake_case ( class_basename ( $ class2 ) ) ; $ models = array ( $ related , $ base ) ; sort ( $ models ) ; return strtolower ( implode ( '_' , $ models ) ) ; }
Generate the database tablename of a pivot table.

@param string $class2
@param string $class1
@param boolean $inverse
@param string $morph
@return string
Generate the database tablename of a pivot table .