PHP code example of marjose123 / filament-webhook-server

1. Go to this page and download the library: Download marjose123/filament-webhook-server 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/ */

    

marjose123 / filament-webhook-server example snippets



use Marjose123\FilamentWebhookServer\WebhookPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
              WebhookPlugin::make()
                    ->icon(Heroicon::AcademicCap) // Set the icon for the plugin
                    ->enableApiRoutes() // Enable the API routes
                    ->bhook plugin
                    ->customPageUsing(webhookPage: Webhooks::class, webhookHistoryPage: WebhookHistory::class) // Set the custom pages for the webhooks plugin if you want to use your own
                    ->enablePlugin(),
        ]);  
       
}


class YourModel extends Model implements Webhookable
{
 //......
 
 public function toWebhookPayload(): array
 {
    return [
        'customAttribute' => $this->yourAttribute
    ];
 }
}
bash
php artisan vendor:publish --tag="filament-webhook-server-migrations"
php artisan migrate