PHP code example of weblabnl / laravel-webhook-call
1. Go to this page and download the library: Download weblabnl/laravel-webhook-call library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
weblabnl / laravel-webhook-call example snippets
return [
// the model to use for the webhook calls
'models' => [
// The model that should be used to store the webhook endpoint data.
'webhook' => \Weblab\WebhookCall\Models\Webhook::class,
// The model that should be used to store the webhook event data.
'webhook_event' => \Weblab\WebhookCall\Models\WebhookEvent::class,
// The model that should be used to store the webhook log data.
'webhook_log' => \Weblab\WebhookCall\Models\WebhookLog::class,
],
];
// fetch a webhook from the database
$webhook = Webhook::find(1);
// call the webhook
WebhookCall::create()
->wehbook($webhook)
->dispatch();
// fetch a webhook from the database
$webhook = Webhook::find(1);
$webhookEvent = $webhook->webhookEvents()
->where('name', 'order.created')
->first();
// call the webhook
WebhookCall::create()
->wehbook($webhook)
->webhookEvent($webhookEvent)
->dispatch();
// fetch a webhook from the database
$webhook = Webhook::find(1);
// fetch an entity from the database
$entity = Order::find(1);
// call the webhook
WebhookCall::create()
->wehbook($webhook)
->entity($entity)
->dispatch();