2020-04-01 14:39:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Mail;
|
|
|
|
|
2021-01-31 06:07:45 +01:00
|
|
|
use App\Models\Company;
|
2020-04-01 14:39:59 +02:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Mail\Mailable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
|
|
class MigrationCompleted extends Mailable
|
|
|
|
{
|
|
|
|
use Queueable, SerializesModels;
|
|
|
|
|
2021-01-31 06:07:45 +01:00
|
|
|
public $company;
|
|
|
|
|
2021-02-10 02:59:30 +01:00
|
|
|
public $check_data;
|
|
|
|
|
2020-04-01 14:39:59 +02:00
|
|
|
/**
|
|
|
|
* Create a new message instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2021-02-10 04:18:23 +01:00
|
|
|
public function __construct(Company $company, $check_data = '')
|
2020-04-01 14:39:59 +02:00
|
|
|
{
|
2021-01-31 06:07:45 +01:00
|
|
|
$this->company = $company;
|
2021-02-10 02:59:30 +01:00
|
|
|
$this->check_data = $check_data;
|
2020-04-01 14:39:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the message.
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function build()
|
|
|
|
{
|
2021-01-31 06:07:45 +01:00
|
|
|
$data['settings'] = $this->company->settings;
|
2021-02-10 07:08:16 +01:00
|
|
|
$data['company'] = $this->company->fresh();
|
2021-02-02 06:11:33 +01:00
|
|
|
$data['whitelabel'] = $this->company->account->isPaid() ? true : false;
|
2021-02-10 02:59:30 +01:00
|
|
|
$data['check_data'] = $this->check_data;
|
|
|
|
|
2021-02-03 13:29:44 +01:00
|
|
|
$result = $this->from(config('mail.from.address'), config('mail.from.name'))
|
|
|
|
->view('email.import.completed', $data);
|
|
|
|
|
|
|
|
if($this->company->invoices->count() >=1)
|
|
|
|
$result->attach($this->company->invoices->first()->pdf_file_path());
|
|
|
|
|
|
|
|
return $result;
|
2020-04-01 14:39:59 +02:00
|
|
|
}
|
|
|
|
}
|