Merge pull request #8034 from turbo124/v5-develop
Add delete webhook for projects
This commit is contained in:
commit
7c57c91f89
3 changed files with 482 additions and 404 deletions
|
|
@ -76,6 +76,9 @@ class Webhook extends BaseModel
|
|||
|
||||
const EVENT_DELETE_CREDIT = 29;
|
||||
|
||||
const EVENT_PROJECT_DELETE = 30;
|
||||
|
||||
|
||||
public static $valid_events = [
|
||||
self::EVENT_CREATE_CLIENT,
|
||||
self::EVENT_CREATE_INVOICE,
|
||||
|
|
@ -106,6 +109,7 @@ class Webhook extends BaseModel
|
|||
self::EVENT_CREATE_CREDIT,
|
||||
self::EVENT_UPDATE_CREDIT,
|
||||
self::EVENT_DELETE_CREDIT,
|
||||
self::EVENT_PROJECT_DELETE
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
|
|||
|
|
@ -61,7 +61,14 @@ class ProjectObserver
|
|||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
873
composer.lock
generated
873
composer.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue