mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 02:14:36 -04:00
Move invoice archive to Base Repository
This commit is contained in:
parent
949722ff57
commit
0f05065279
@ -93,18 +93,4 @@ class InvoiceObserver
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
* @return void
|
||||
*/
|
||||
public function archived(Invoice $invoice){
|
||||
$subscriptions = Webhook::where('company_id', $invoice->company_id)
|
||||
->where('event_id', Webhook::EVENT_ARCHIVE_INVOICE)
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Jobs\Product\UpdateOrCreateProduct;
|
||||
use App\Jobs\Util\WebhookHandler;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
@ -19,6 +20,7 @@ use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\Webhook;
|
||||
use App\Utils\Helpers;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -60,6 +62,13 @@ class BaseRepository
|
||||
|
||||
if (class_exists($className)) {
|
||||
event(new $className($entity, $entity->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
$subscriptions = Webhook::where('company_id', $entity->company_id)
|
||||
->where('event_id', Webhook::EVENT_ARCHIVE_INVOICE)
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_INVOICE, $entity, $entity->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user