# Webhook Model

DB Table Name Inherits from the Meta model {wp_db_prefix}_fbs_metas
Source File fluent-boards/app/Models/Webhook.php
Name Space FluentBoards\App\Models
Class FluentBoards\App\Models\Webhook

# Attributes

  • object_id: The ID of the object associated with the webhook.
  • object_type: The type of the object, which is always 'webhook' for this model.
  • key: A unique identifier for the webhook, generated using wp_generate_uuid4().
  • value: Stores the data associated with the webhook, including the URL.

# Methods

Along with Global Model methods, this model has few helper methods.

# getFields

This method returns an array of fields that are mappable in tasks.

# Example:

$fields = $webhook->getFields();
1

# getSchema

Returns a schema array for the webhook, which includes the name and url.

# Example:

$schema = $webhook->getSchema();
1

# store($data)

Creates a new webhook record with the provided data. The URL is auto-generated using the site URL and a unique hash.

  • Parameters
    • $key $data
  • Returns array of the newly created webhook.

# Example:

$newWebhook = Webhook::store($data);
1

# saveChanges($newData)

Updates the webhook's value field with new data, excluding certain keys like id and url, and then saves the changes.

  • Parameters
    • $newData array
  • Returns void // No return value

# Example:

$webhook->saveChanges($newData);
1

1