1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Services/Email/MailEntity.php

64 lines
1.4 KiB
PHP
Raw Normal View History

2023-02-13 11:09:19 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\Email;
use App\Libraries\MultiDB;
use App\Models\Company;
2023-02-14 00:03:54 +01:00
use App\Services\Email\MailBuild;
2023-02-13 11:09:19 +01:00
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
2023-02-14 00:03:54 +01:00
class MailEntity extends BaseMailer implements ShouldQueue
2023-02-13 11:09:19 +01:00
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected Company $company;
2023-02-14 00:03:54 +01:00
public function __construct(protected $invitation, private ?string $db, public MailObject $mail_object)
2023-02-13 11:09:19 +01:00
{
$this->invitation = $invitation;
2023-02-14 00:03:54 +01:00
$this->company = $invitation->company;
2023-02-13 11:09:19 +01:00
2023-02-14 00:03:54 +01:00
$this->db = $db;
2023-02-13 11:09:19 +01:00
2023-02-14 00:03:54 +01:00
$this->mail_object = $mail_object;
2023-02-13 11:09:19 +01:00
2023-02-14 00:03:54 +01:00
$this->override = $mail_object->override;
2023-02-13 11:09:19 +01:00
}
2023-02-14 00:03:54 +01:00
public function handle(MailBuild $builder): void
2023-02-13 11:09:19 +01:00
{
MultiDB::setDb($this->db);
2023-02-14 00:03:54 +01:00
$this->companyCheck();
2023-02-13 11:09:19 +01:00
//construct mailable
2023-02-14 00:03:54 +01:00
//spam checks
//what do we pass into a generaic builder?
2023-02-13 11:09:19 +01:00
//construct mailer
2023-02-14 00:03:54 +01:00
$mailer = $this->configureMailer()
->trySending();
2023-02-13 11:09:19 +01:00
2023-02-14 00:03:54 +01:00
2023-02-13 11:09:19 +01:00
}
}