akaunting 3.0 (the last dance)

This commit is contained in:
Burak Civan
2022-06-01 10:15:55 +03:00
parent cead09f6d4
commit d9c0764572
3812 changed files with 126831 additions and 102949 deletions

View File

@ -0,0 +1,34 @@
<?php
namespace App\Jobs\Document;
use App\Abstracts\Job;
use App\Events\Document\DocumentSent;
use App\Models\Document\Document;
class SendDocumentAsCustomMail extends Job
{
public function __construct($request, $template_alias)
{
$this->request = $request;
$this->template_alias = $template_alias;
}
public function handle(): void
{
$document = Document::find($this->request->get('document_id'));
$custom_mail = $this->request->only(['to', 'subject', 'body']);
if ($this->request->has('user_email')) {
$custom_mail['cc'] = user()->email;
}
$notification = config('type.document.' . $document->type . '.notification.class');
// Notify the contact
$document->contact->notify(new $notification($document, $this->template_alias, true, $custom_mail));
event(new DocumentSent($document));
}
}