protected function handlePaperclipAttachments()
    {
        // Paperclip / attachment attributes
        $attachments = $this->detectPaperclipAttachments();

        // Make a list of attributes to insert before the paperclip attributes
        /** @var ModelAttributeData[] $inserts */
        $inserts = [];

        foreach ($attachments as $key => $attachment) {

            $attribute = new ModelAttributeData([
                'name'     => $key,
                'cast'     => AttributeCast::PAPERCLIP_ATTACHMENT,
                'type'     => $attachment->image ? 'image' : 'file',
            ]);

            $inserts[ $key . '_file_name' ] = $attribute;
        }


        if ( ! count($inserts)) {
            return $this;
        }

        $attributes = $this->info->attributes;

        foreach ($inserts as $before => $attribute) {

            $attributes = $this->insertInArray($attributes, $attribute->name, $attribute, $before);
        }

        $this->info->attributes = $attributes;

        return $this;
    }
protected function handlePaperclipAttachments()
    {
        // Paperclip / attachment attributes
        $attachments = $this->detectPaperclipAttachments();

        // Make a list of attributes to insert before the paperclip attributes
        /** @var ModelAttributeData[] $inserts */
        $inserts = [];

        foreach ($attachments as $key => $attachment) {

            $attribute = new ModelAttributeData([
                'name'     => $key,
                'cast'     => AttributeCast::PAPERCLIP_ATTACHMENT,
                'type'     => $attachment->image ? 'image' : 'file',
            ]);

            $inserts[ $key . '_file_name' ] = $attribute;
        }


        if ( ! count($inserts)) {
            return $this;
        }

        $attributes = $this->info->attributes;

        foreach ($inserts as $before => $attribute) {

            $attributes = $this->insertInArray($attributes, $attribute->name, $attribute, $before);
        }

        $this->info->attributes = $attributes;

        return $this;
    }
protected function handlePaperclipAttachments ( ) { // Paperclip / attachment attributes $ attachments = $ this -> detectPaperclipAttachments ( ) ; // Make a list of attributes to insert before the paperclip attributes /** @var ModelAttributeData[] $inserts */ $ inserts = [ ] ; foreach ( $ attachments as $ key => $ attachment ) { $ attribute = new ModelAttributeData ( [ 'name' => $ key , 'cast' => AttributeCast :: PAPERCLIP_ATTACHMENT , 'type' => $ attachment -> image ? 'image' : 'file' , ] ) ; $ inserts [ $ key . '_file_name' ] = $ attribute ; } if ( ! count ( $ inserts ) ) { return $ this ; } $ attributes = $ this -> info -> attributes ; foreach ( $ inserts as $ before => $ attribute ) { $ attributes = $ this -> insertInArray ( $ attributes , $ attribute -> name , $ attribute , $ before ) ; } $ this -> info -> attributes = $ attributes ; return $ this ; }
Handles analysis of paperclip attachments.

@return $this
Handles analysis of paperclip attachments .