1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Fixes for Email Controller (#3562)

* Fixes for notifications

* Fixes for email controller
This commit is contained in:
David Bomba 2020-03-29 23:53:00 +11:00 committed by GitHub
parent 9d6da3e37b
commit 54500cd558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,13 +14,23 @@ namespace App\Http\Controllers;
use App\Helpers\Email\InvoiceEmail;
use App\Http\Requests\Email\SendEmailRequest;
use App\Jobs\Invoice\EmailInvoice;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Quote;
use App\Notifications\SendGenericNotification;
use App\Transformers\CreditTransformer;
use App\Transformers\InvoiceTransformer;
use App\Transformers\QuoteTransformer;
use App\Utils\Traits\MakesHash;
class EmailController extends BaseController
{
use MakesHash;
protected $entity_type = Invoice::class ;
protected $entity_transformer = InvoiceTransformer::class ;
public function __construct()
{
parent::__construct();
@ -115,9 +125,25 @@ class EmailController extends BaseController
});
$entity->service()->markSent()->save();
if ($this instanceof Invoice) {
$this->entity_type = Invoice::class ;
$this->entity_transformer = InvoiceTransformer::class ;
}
if ($this instanceof Quote) {
$this->entity_type = Quote::class ;
$this->entity_transformer = QuoteTransformer::class ;
}
if ($this instanceof Credit) {
$this->entity_type = Credit::class ;
$this->entity_transformer = CreditTransformer::class ;
}
$entity_obj->service()->markSent()->save();
return $this->itemResponse($entity_obj);
return $this->itemResponse($entity);
}
}