mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor cleanup
This commit is contained in:
parent
0de3b4a0ff
commit
ec5bc57737
@ -206,12 +206,22 @@ class BaseModel extends Model
|
|||||||
return ctrans('texts.item');
|
return ctrans('texts.item');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendEvent($event_id, $additional_data=""){
|
/**
|
||||||
|
* Model helper to send events for webhooks
|
||||||
|
*
|
||||||
|
* @param int $event_id
|
||||||
|
* @param string $additional_data optional includes
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function sendEvent(int $event_id, string $additional_data = ""): void
|
||||||
|
{
|
||||||
$subscriptions = Webhook::where('company_id', $this->company_id)
|
$subscriptions = Webhook::where('company_id', $this->company_id)
|
||||||
->where('event_id', $event_id)
|
->where('event_id', $event_id)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch($event_id, $this, $this->company, $additional_data)->delay(0);
|
WebhookHandler::dispatch($event_id, $this, $this->company, $additional_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user