public function prepareAttachmentDataForInsert($emailMessageID, $attachment, $attachmentPath, $data=null) {

        $data1 = [];
        $data1['email_messages_id']   = $emailMessageID;
        $data1['attachment_path']     = $attachmentPath;
        $data1['attachment_filename'] = $data['attachment-'.$attachment]->getClientOriginalName();

        if (!empty($data['alternate_sort_string1'])) {
            $data1['alternate_sort_string1'] = $data['alternate_sort_string1'];
        } else {
            $data1['alternate_sort_string1'] = null;
        }

        if (!empty($data['alternate_sort_string2'])) {
            $data1['alternate_sort_string2'] = $data['alternate_sort_string2'];
        } else {
            $data1['alternate_sort_string2'] = null;
        }

        if (!empty($data['comments'])) {
            $data1['comments']         = $data['comments'];
        } else {
            $data1['comments']         = null;
        }

        return $data1;
    }
public function prepareAttachmentDataForInsert($emailMessageID, $attachment, $attachmentPath, $data=null) {

        $data1 = [];
        $data1['email_messages_id']   = $emailMessageID;
        $data1['attachment_path']     = $attachmentPath;
        $data1['attachment_filename'] = $data['attachment-'.$attachment]->getClientOriginalName();

        if (!empty($data['alternate_sort_string1'])) {
            $data1['alternate_sort_string1'] = $data['alternate_sort_string1'];
        } else {
            $data1['alternate_sort_string1'] = null;
        }

        if (!empty($data['alternate_sort_string2'])) {
            $data1['alternate_sort_string2'] = $data['alternate_sort_string2'];
        } else {
            $data1['alternate_sort_string2'] = null;
        }

        if (!empty($data['comments'])) {
            $data1['comments']         = $data['comments'];
        } else {
            $data1['comments']         = null;
        }

        return $data1;
    }
public function prepareAttachmentDataForInsert ( $ emailMessageID , $ attachment , $ attachmentPath , $ data = null ) { $ data1 = [ ] ; $ data1 [ 'email_messages_id' ] = $ emailMessageID ; $ data1 [ 'attachment_path' ] = $ attachmentPath ; $ data1 [ 'attachment_filename' ] = $ data [ 'attachment-' . $ attachment ] -> getClientOriginalName ( ) ; if ( ! empty ( $ data [ 'alternate_sort_string1' ] ) ) { $ data1 [ 'alternate_sort_string1' ] = $ data [ 'alternate_sort_string1' ] ; } else { $ data1 [ 'alternate_sort_string1' ] = null ; } if ( ! empty ( $ data [ 'alternate_sort_string2' ] ) ) { $ data1 [ 'alternate_sort_string2' ] = $ data [ 'alternate_sort_string2' ] ; } else { $ data1 [ 'alternate_sort_string2' ] = null ; } if ( ! empty ( $ data [ 'comments' ] ) ) { $ data1 [ 'comments' ] = $ data [ 'comments' ] ; } else { $ data1 [ 'comments' ] = null ; } return $ data1 ; }
Prepare the data for the INSERT into the "email_attachments" db table.

@param  int    $emailMessageID    The ID of the just inserted "email_messages" record
@param  int    $attachment        What attachment number? eg, attachment-1. AKA, Mailgun's "attachment-x" post var
@param  string $attachmentPath    Where are the attachments saved?
@param  array  $data              Inbound POST vars, and processed vars,
@return array
Prepare the data for the INSERT into the email_attachments db table .