public function attach($pathToFile, array $options = [])
    {
        if (is_array($pathToFile)) {
            foreach($pathToFile as $attachment) {

                if (isset($attachment['options']) && array_key_exists("options", $attachment)) {
                    $options = $attachment['options'];
                } else {
                    $options = [];
                }
                $this->addAttachment($attachment['path'], $options);
            }
        } else {
            $this->addAttachment($pathToFile, $options);
        }

        return $this;
    }
public function attach($pathToFile, array $options = [])
    {
        if (is_array($pathToFile)) {
            foreach($pathToFile as $attachment) {

                if (isset($attachment['options']) && array_key_exists("options", $attachment)) {
                    $options = $attachment['options'];
                } else {
                    $options = [];
                }
                $this->addAttachment($attachment['path'], $options);
            }
        } else {
            $this->addAttachment($pathToFile, $options);
        }

        return $this;
    }
public function attach ( $ pathToFile , array $ options = [ ] ) { if ( is_array ( $ pathToFile ) ) { foreach ( $ pathToFile as $ attachment ) { if ( isset ( $ attachment [ 'options' ] ) && array_key_exists ( "options" , $ attachment ) ) { $ options = $ attachment [ 'options' ] ; } else { $ options = [ ] ; } $ this -> addAttachment ( $ attachment [ 'path' ] , $ options ) ; } } else { $ this -> addAttachment ( $ pathToFile , $ options ) ; } return $ this ; }
Attaches file to mail

@param $pathToFile
@param array $options
@return $this|object
Attaches file to mail