protected function getMorphableClasses($relatedEntity, $morphName, array $metadata, $many=false)
    {
        $morphableClasses = [];

        foreach ($metadata as $entityMetadata) {
            foreach ($entityMetadata['relations'] as $relationMetadata) {
                // check relation type
                if (! ((! $many && $relationMetadata['type'] == 'morphOne')
                    || (! $many && $relationMetadata['type'] == 'morphMany')
                    || ($many && $relationMetadata['type'] == 'morphToMany' && $relationMetadata['options']['inverse']))) {
                    continue;
                }

                // check foreign entity and morph name
                if ($relationMetadata['relatedEntity'] == $relatedEntity
                    && $relationMetadata['options']['morphName'] == $morphName) {
                    $morphableClasses[$entityMetadata['morphClass']] = $entityMetadata['class'];
                }
            }
        }

        return $morphableClasses;
    }
protected function getMorphableClasses($relatedEntity, $morphName, array $metadata, $many=false)
    {
        $morphableClasses = [];

        foreach ($metadata as $entityMetadata) {
            foreach ($entityMetadata['relations'] as $relationMetadata) {
                // check relation type
                if (! ((! $many && $relationMetadata['type'] == 'morphOne')
                    || (! $many && $relationMetadata['type'] == 'morphMany')
                    || ($many && $relationMetadata['type'] == 'morphToMany' && $relationMetadata['options']['inverse']))) {
                    continue;
                }

                // check foreign entity and morph name
                if ($relationMetadata['relatedEntity'] == $relatedEntity
                    && $relationMetadata['options']['morphName'] == $morphName) {
                    $morphableClasses[$entityMetadata['morphClass']] = $entityMetadata['class'];
                }
            }
        }

        return $morphableClasses;
    }
protected function getMorphableClasses ( $ relatedEntity , $ morphName , array $ metadata , $ many = false ) { $ morphableClasses = [ ] ; foreach ( $ metadata as $ entityMetadata ) { foreach ( $ entityMetadata [ 'relations' ] as $ relationMetadata ) { // check relation type if ( ! ( ( ! $ many && $ relationMetadata [ 'type' ] == 'morphOne' ) || ( ! $ many && $ relationMetadata [ 'type' ] == 'morphMany' ) || ( $ many && $ relationMetadata [ 'type' ] == 'morphToMany' && $ relationMetadata [ 'options' ] [ 'inverse' ] ) ) ) { continue ; } // check foreign entity and morph name if ( $ relationMetadata [ 'relatedEntity' ] == $ relatedEntity && $ relationMetadata [ 'options' ] [ 'morphName' ] == $ morphName ) { $ morphableClasses [ $ entityMetadata [ 'morphClass' ] ] = $ entityMetadata [ 'class' ] ; } } } return $ morphableClasses ; }
Get array of morphable classes for a morphTo or morphToMany relation.

@param string $relatedEntity
@param string $morphName
@param array $metadata
@param boolean $many
@return void
Get array of morphable classes for a morphTo or morphToMany relation .