mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Fixes for Email Controller (#3562)
* Fixes for notifications * Fixes for email controller
This commit is contained in:
parent
9d6da3e37b
commit
54500cd558
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user