src/Conversion/ConversionCollection.php
protected function addConversionsFromRelatedModel(Media $media)
    {
        $modelName = Arr::get(Relation::morphMap(), $media->model_type, $media->model_type);

        /** @var \Spatie\MediaLibrary\HasMedia\HasMedia $model */
        $model = new $modelName();

        /*
         * In some cases the user might want to get the actual model
         * instance so conversion parameters can depend on model
         * properties. This will causes extra queries.
         */
        if ($model->registerMediaConversionsUsingModelInstance) {
            $model = $media->model;

            $model->mediaConversion = [];
        }

        $model->registerAllMediaConversions($media);

        $this->items = $model->mediaConversions;
    }
protected function addConversionsFromRelatedModel(Media $media)
    {
        $modelName = Arr::get(Relation::morphMap(), $media->model_type, $media->model_type);

        /** @var \Spatie\MediaLibrary\HasMedia\HasMedia $model */
        $model = new $modelName();

        /*
         * In some cases the user might want to get the actual model
         * instance so conversion parameters can depend on model
         * properties. This will causes extra queries.
         */
        if ($model->registerMediaConversionsUsingModelInstance) {
            $model = $media->model;

            $model->mediaConversion = [];
        }

        $model->registerAllMediaConversions($media);

        $this->items = $model->mediaConversions;
    }
protected function addConversionsFromRelatedModel ( Media $ media ) { $ modelName = Arr :: get ( Relation :: morphMap ( ) , $ media -> model_type , $ media -> model_type ) ; /** @var \Spatie\MediaLibrary\HasMedia\HasMedia $model */ $ model = new $ modelName ( ) ; /*
         * In some cases the user might want to get the actual model
         * instance so conversion parameters can depend on model
         * properties. This will causes extra queries.
         */ if ( $ model -> registerMediaConversionsUsingModelInstance ) { $ model = $ media -> model ; $ model -> mediaConversion = [ ] ; } $ model -> registerAllMediaConversions ( $ media ) ; $ this -> items = $ model -> mediaConversions ; }
Add the conversion that are defined on the related model of
the given media.

@param \Spatie\MediaLibrary\Models\Media $media
Add the conversion that are defined on the related model of the given media .