mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Send payment emails to all contacts on invitation
This commit is contained in:
parent
784d28ef0f
commit
0d11fc174a
@ -32,12 +32,27 @@ class SendEmail
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->payment->load('company', 'client.contacts');
|
||||
$this->payment->load('company', 'client.contacts','invoices');
|
||||
|
||||
$contact = $this->payment->client->contacts()->first();
|
||||
|
||||
if ($contact?->email)
|
||||
EmailPayment::dispatch($this->payment, $this->payment->company, $contact)->delay(now()->addSeconds(8));
|
||||
// if ($contact?->email)
|
||||
// EmailPayment::dispatch($this->payment, $this->payment->company, $contact)->delay(now()->addSeconds(2));
|
||||
|
||||
|
||||
$this->payment->invoices->sortByDesc('id')->first(function ($invoice){
|
||||
|
||||
$invoice->invitations->each(function ($invitation) {
|
||||
|
||||
if(!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||
|
||||
EmailPayment::dispatch($this->payment, $this->payment->company, $invitation->contact)->delay(now()->addSeconds(2));
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user