diff --git a/app/Factory/WebhookFactory.php b/app/Factory/WebhookFactory.php index 045ed87cb258..bced2b321690 100644 --- a/app/Factory/WebhookFactory.php +++ b/app/Factory/WebhookFactory.php @@ -23,7 +23,9 @@ class WebhookFactory $webhook->target_url = ''; $webhook->event_id = 1; $webhook->format = 'JSON'; - + $webhook->rest_method = 'post'; + $webhook->headers = []; + return $webhook; } } diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 8684fd757459..1540f87f6604 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -57,6 +57,12 @@ class Webhook extends BaseModel 'target_url', 'format', 'event_id', + 'rest_method', + 'headers', + ]; + + protected $casts = [ + 'headers' => 'array', ]; public function user() diff --git a/database/migrations/2021_04_05_213802_add_rest_fields_to_webhooks_table.php b/database/migrations/2021_04_05_213802_add_rest_fields_to_webhooks_table.php new file mode 100644 index 000000000000..ca43f4c01af0 --- /dev/null +++ b/database/migrations/2021_04_05_213802_add_rest_fields_to_webhooks_table.php @@ -0,0 +1,33 @@ +text('rest_method')->nullable(); + $table->text('headers')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('webhooks', function (Blueprint $table) { + // + }); + } +}