mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 18:24:35 -04:00
Add delete webhook for projects
This commit is contained in:
parent
aac14ea1e5
commit
855206fb15
@ -76,6 +76,9 @@ class Webhook extends BaseModel
|
|||||||
|
|
||||||
const EVENT_DELETE_CREDIT = 29;
|
const EVENT_DELETE_CREDIT = 29;
|
||||||
|
|
||||||
|
const EVENT_PROJECT_DELETE = 30;
|
||||||
|
|
||||||
|
|
||||||
public static $valid_events = [
|
public static $valid_events = [
|
||||||
self::EVENT_CREATE_CLIENT,
|
self::EVENT_CREATE_CLIENT,
|
||||||
self::EVENT_CREATE_INVOICE,
|
self::EVENT_CREATE_INVOICE,
|
||||||
@ -106,6 +109,7 @@ class Webhook extends BaseModel
|
|||||||
self::EVENT_CREATE_CREDIT,
|
self::EVENT_CREATE_CREDIT,
|
||||||
self::EVENT_UPDATE_CREDIT,
|
self::EVENT_UPDATE_CREDIT,
|
||||||
self::EVENT_DELETE_CREDIT,
|
self::EVENT_DELETE_CREDIT,
|
||||||
|
self::EVENT_PROJECT_DELETE
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
@ -61,7 +61,14 @@ class ProjectObserver
|
|||||||
*/
|
*/
|
||||||
public function deleted(Project $project)
|
public function deleted(Project $project)
|
||||||
{
|
{
|
||||||
//
|
//EVENT_PROJECT_DELETE
|
||||||
|
$subscriptions = Webhook::where('company_id', $project->company_id)
|
||||||
|
->where('event_id', Webhook::EVENT_PROJECT_DELETE)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($subscriptions) {
|
||||||
|
WebhookHandler::dispatch(Webhook::EVENT_PROJECT_DELETE, $project, $project->company, 'client')->delay(now()->addSeconds(2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user