File: /var/www/vhost/disk-apps/sigedo-qas.allup.com.co/app/Mail/SendNotification.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class SendNotification extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public $data;
public function __construct($data)
{
$this->data = $data;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
if($this->data->attached){
$file = file_get_contents($this->data->attached);
return $this->from($address = config('mail.username'), $name = $this->data->subject)
->subject($this->data->subject)
->attachData($file, $this->data->attached_name, [
'mime' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
])
->view('mails.notifications');
}
return $this->from($address = config('mail.username'), $name = $this->data->subject)
->subject($this->data->subject)
->view('mails.notifications');
}
}