protected function includeAttachments($raw)
    {
        $attachments = [];

        foreach ($this->attachments as $attachment => $refinery) {
            if (isset($refinery['raw'])) {
                $attachments[$attachment] = $refinery['raw']($raw);
            } else {
                $class = $refinery['class'];
                $callback = $refinery['callback'];

                if ( ! $callback) {
                    $items = $this->getItems($raw, $class, $attachment);
                } else {
                    $items = $this->getItemsUsingCallback($raw, $class, $callback);
                }

                $attachments[$attachment] = ! is_null($items) ? $class->refine($items) : null;
            }
        }

        return $attachments;
    }
protected function includeAttachments($raw)
    {
        $attachments = [];

        foreach ($this->attachments as $attachment => $refinery) {
            if (isset($refinery['raw'])) {
                $attachments[$attachment] = $refinery['raw']($raw);
            } else {
                $class = $refinery['class'];
                $callback = $refinery['callback'];

                if ( ! $callback) {
                    $items = $this->getItems($raw, $class, $attachment);
                } else {
                    $items = $this->getItemsUsingCallback($raw, $class, $callback);
                }

                $attachments[$attachment] = ! is_null($items) ? $class->refine($items) : null;
            }
        }

        return $attachments;
    }
protected function includeAttachments ( $ raw ) { $ attachments = [ ] ; foreach ( $ this -> attachments as $ attachment => $ refinery ) { if ( isset ( $ refinery [ 'raw' ] ) ) { $ attachments [ $ attachment ] = $ refinery [ 'raw' ] ( $ raw ) ; } else { $ class = $ refinery [ 'class' ] ; $ callback = $ refinery [ 'callback' ] ; if ( ! $ callback ) { $ items = $ this -> getItems ( $ raw , $ class , $ attachment ) ; } else { $ items = $ this -> getItemsUsingCallback ( $ raw , $ class , $ callback ) ; } $ attachments [ $ attachment ] = ! is_null ( $ items ) ? $ class -> refine ( $ items ) : null ; } } return $ attachments ; }
Return any required attachments. Check if the attachment needs to
be filtered, if so they run the callback and then return the
attachments.

@param  mixed $raw
@return mixed
Return any required attachments . Check if the attachment needs to be filtered if so they run the callback and then return the attachments .