protected function getMorphManyData($relation, $foreignKeyIds)
    {
        $relatedClass = $relation->getRelated();
        $foreignKeyUse = $relatedClass->getKeyName();
        $foreignKeyIdsUse = $relatedClass::withTrashed()->where($relation->getMorphType(), $relation->getMorphClass())
            ->whereIn($relation->getQualifiedForeignKeyName(), $foreignKeyIds)
            ->select($foreignKeyUse)
            ->get()->toArray();
        $foreignKeyIdsUse = array_column($foreignKeyIdsUse, $foreignKeyUse);

        return [
            'foreignKeyIdsUse' => collect($foreignKeyIdsUse),
            'foreignKeyUse'    => $relation->getRelated()->getKeyName(),
        ];
    }
protected function getMorphManyData($relation, $foreignKeyIds)
    {
        $relatedClass = $relation->getRelated();
        $foreignKeyUse = $relatedClass->getKeyName();
        $foreignKeyIdsUse = $relatedClass::withTrashed()->where($relation->getMorphType(), $relation->getMorphClass())
            ->whereIn($relation->getQualifiedForeignKeyName(), $foreignKeyIds)
            ->select($foreignKeyUse)
            ->get()->toArray();
        $foreignKeyIdsUse = array_column($foreignKeyIdsUse, $foreignKeyUse);

        return [
            'foreignKeyIdsUse' => collect($foreignKeyIdsUse),
            'foreignKeyUse'    => $relation->getRelated()->getKeyName(),
        ];
    }
protected function getMorphManyData ( $ relation , $ foreignKeyIds ) { $ relatedClass = $ relation -> getRelated ( ) ; $ foreignKeyUse = $ relatedClass -> getKeyName ( ) ; $ foreignKeyIdsUse = $ relatedClass :: withTrashed ( ) -> where ( $ relation -> getMorphType ( ) , $ relation -> getMorphClass ( ) ) -> whereIn ( $ relation -> getQualifiedForeignKeyName ( ) , $ foreignKeyIds ) -> select ( $ foreignKeyUse ) -> get ( ) -> toArray ( ) ; $ foreignKeyIdsUse = array_column ( $ foreignKeyIdsUse , $ foreignKeyUse ) ; return [ 'foreignKeyIdsUse' => collect ( $ foreignKeyIdsUse ) , 'foreignKeyUse' => $ relation -> getRelated ( ) -> getKeyName ( ) , ] ; }
Get morph many related key ids and key use.

@param Illuminate\Database\Eloquent\Relations\Relation $relation
@param array                                           $foreignKeyIds

@return array
Get morph many related key ids and key use .