タイトルの通りとなります。
Mailableクラスのfunction build()内にattachでファイルを添付しているのですが、これを複数ファイルにしたいと思っております。
これの記述方法をご教授頂けないでしょうか?
PHP
1class sendMail extends Mailable 2{ 3 use Queueable, SerializesModels; 4 5 public $contact; 6 public $file; 7 /** 8 * Create a new message instance. 9 * 10 * @return void 11 */ 12 public function __construct(Contact $contact, $file) 13 { 14 $this->contact = $contact; 15 $this->file1 = $file[0]; //Controller内で、ファイルを配列に入れてあります 16 $this->file2 = $file[1]; 17 $this->file3 = $file[2]; 18 } 19 20 public function build() 21 { 22 return $this->subject('件名') 23 ->text('blade') 24 ->attach($this->file1, [ 25 'as' => 'test.jpg', 26 ], $this->file2, [ 27 'as' => 'test2.jpg', 28 ], $this->file3, [ 29 'as' => 'test3.jpg', 30 ]); 31 } 32}
この場合ですと、一番最初のtest.jpgしか送信ができません。$fileの配列内にはすべてデータが入っていることを確認しています。
よろしくお願い致します。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/02 07:23