File tree 1 file changed +16
-4
lines changed
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)
218
218
*/
219
219
public function attach ($ file , $ options = [])
220
220
{
221
- $ attachments = $ this -> hasData ( ' attachments ' ) ? $ this -> getData ( ' attachments ' ) : [] ;
221
+ $ attachments = null ;
222
222
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
+ }
224
230
225
231
return $ this ->setData ('attachments ' , $ attachments );
226
232
}
@@ -235,9 +241,15 @@ public function attach($file, $options = [])
235
241
*/
236
242
public function attachData ($ data , $ name , array $ options = [])
237
243
{
238
- $ attachments = $ this -> hasData ( ' rawAttachments ' ) ? $ this -> getData ( ' rawAttachments ' ) : [] ;
244
+ $ attachments = null ;
239
245
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
+ }
241
253
242
254
return $ this ->setData ('rawAttachments ' , $ attachments );
243
255
}
You can’t perform that action at this time.
0 commit comments