classes/Models/Traits/Exportable.php
protected function mapExportAttribute($value, $key)
    {
        // If an images relationship
        if ($key == 'images') {
            return implode(',', array_map(function($image) {
                return $image['file'];
            }, $value));
        }

        // If another array...
        if (is_array($value)) {
            return implode(',', array_map(function($child) {

                // If sub array, like if this was some relation, return the id
                // so this becomes an array of those ids
                if (is_array($child) && isset($child['id'])) {
                    return $child['id'];
                }

                // If anything else, just return it
                return $child;
            }, $value));
        }

        // Otherwise, just pass through value
        return $value;
    }
protected function mapExportAttribute($value, $key)
    {
        // If an images relationship
        if ($key == 'images') {
            return implode(',', array_map(function($image) {
                return $image['file'];
            }, $value));
        }

        // If another array...
        if (is_array($value)) {
            return implode(',', array_map(function($child) {

                // If sub array, like if this was some relation, return the id
                // so this becomes an array of those ids
                if (is_array($child) && isset($child['id'])) {
                    return $child['id'];
                }

                // If anything else, just return it
                return $child;
            }, $value));
        }

        // Otherwise, just pass through value
        return $value;
    }
protected function mapExportAttribute ( $ value , $ key ) { // If an images relationship if ( $ key == 'images' ) { return implode ( ',' , array_map ( function ( $ image ) { return $ image [ 'file' ] ; } , $ value ) ) ; } // If another array... if ( is_array ( $ value ) ) { return implode ( ',' , array_map ( function ( $ child ) { // If sub array, like if this was some relation, return the id // so this becomes an array of those ids if ( is_array ( $ child ) && isset ( $ child [ 'id' ] ) ) { return $ child [ 'id' ] ; } // If anything else, just return it return $ child ; } , $ value ) ) ; } // Otherwise, just pass through value return $ value ; }
Massage attribute values for export

@return scalar
Massage attribute values for export