Fire invoice pdf creator when an invoice has been updated
This commit is contained in:
parent
6fce752de4
commit
0803ffda11
|
|
@ -35,6 +35,10 @@ class CreateInvoicePdf implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
PdfCreator::dispatch($event->invoice->invitations->first());
|
$event->invoice->invitations->each(function ($invitation) {
|
||||||
|
|
||||||
|
PdfCreator::dispatch($invitation);
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
use App\Events\Invoice\InvoiceWasUpdated;
|
||||||
use App\Factory\InvoiceInvitationFactory;
|
use App\Factory\InvoiceInvitationFactory;
|
||||||
use App\Factory\QuoteInvitationFactory;
|
use App\Factory\QuoteInvitationFactory;
|
||||||
use App\Jobs\Product\UpdateOrCreateProduct;
|
use App\Jobs\Product\UpdateOrCreateProduct;
|
||||||
|
|
@ -294,6 +295,9 @@ class BaseRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$model = $model->calc()->getInvoice();
|
$model = $model->calc()->getInvoice();
|
||||||
|
|
||||||
|
event(new InvoiceWasUpdated($model));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($class->name == Credit::class) {
|
if ($class->name == Credit::class) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue