File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -218,9 +218,15 @@ public function mailable(Mailable $mailable)
218218 */
219219 public function attach ($ file , $ options = [])
220220 {
221- $ attachments = $ this -> hasData ( ' attachments ' ) ? $ this -> getData ( ' attachments ' ) : [] ;
221+ $ attachments = null ;
222222
223- $ attachments [] = compact ('file ' , 'options ' );
223+ if ( !empty ($ file ) || !is_null ($ file ) ) {
224+
225+ $ attachments = $ this ->hasData ('attachments ' ) ? $ this ->getData ('attachments ' ) : [];
226+
227+ $ attachments [] = compact ('file ' , 'options ' );
228+
229+ }
224230
225231 return $ this ->setData ('attachments ' , $ attachments );
226232 }
@@ -235,9 +241,15 @@ public function attach($file, $options = [])
235241 */
236242 public function attachData ($ data , $ name , array $ options = [])
237243 {
238- $ attachments = $ this -> hasData ( ' rawAttachments ' ) ? $ this -> getData ( ' rawAttachments ' ) : [] ;
244+ $ attachments = null ;
239245
240- $ attachments [] = compact ('data ' , 'name ' , 'options ' );
246+ if ( !empty ($ data ) || !is_null ($ data ) ) {
247+
248+ $ attachments = $ this ->hasData ('rawAttachments ' ) ? $ this ->getData ('rawAttachments ' ) : [];
249+
250+ $ attachments [] = compact ('data ' , 'name ' , 'options ' );
251+
252+ }
241253
242254 return $ this ->setData ('rawAttachments ' , $ attachments );
243255 }
You can’t perform that action at this time.
0 commit comments