Laravel AWS SNS Events
7.x
7.x
  • โšกIntroduction
  • ๐ŸŽ‰Support
  • Getting Started
    • โฌ†๏ธUpgrading from 6.x
    • ๐Ÿš€Installation
    • ๐Ÿ“กConfiguring Events
    • ๐ŸงชTesting your implementation
  • Customization
    • ๐Ÿ“ฆCustom Payload
    • ๐ŸคฟCustom Event Classes
    • ๐Ÿ”—Custom Method Hooks
  • AWS Webhooks
    • โšกIntroduction
    • ๐Ÿš€Installation
    • ๐Ÿ™ŒShowcase
    • ๐Ÿ–ฅ๏ธSupported AWS Services
      • ๐ŸšจCloudWatch Alerts
      • ๐Ÿ“งSimple Email Service (SES)
      • ๐ŸŒ‰EventBridge Events
    • ๐ŸงชTesting your implementation
Powered by GitBook
On this page

Was this helpful?

  1. Customization

Custom Event Classes

Like the payload, you can also change the event classes to trigger the confirmation or the normal notification.

Simply, replace the following two methods on the extended controller:

/**
 * Get the event class to trigger during subscription confirmation.
 *
 * @return string
 */
protected function getSubscriptionConfirmationEventClass(): string
{
    return CustomSubscriptionConfirmation::class;
}

/**
 * Get the event class to trigger during SNS event.
 *
 * @return string
 */
protected function getNotificationEventClass(): string
{
    return CustomSnsEvent::class;
}

To avoid any issues, remember to extend the respective, original event classes before the change. This will save you a lot of time for debugging in case features are added to the original events.

// CustomSnsEvent.php

use Rennokki\LaravelSnsEvents\Events\SnsNotification;

class CustomSnsEvent extends SnsNotification
{
    //
}
// CustomSubscriptionConfirmation.php

use Rennokki\LaravelSnsEvents\Events\SnsSubscriptionConfirmation;

class CustomSubscriptionConfirmation extends SnsSubscriptionConfirmation
{
    //
}
PreviousCustom PayloadNextCustom Method Hooks

Last updated 3 years ago

Was this helpful?

Make sure you also use the custom event classes in the EventServiceProvider class as described in the section.

๐Ÿคฟ
Configuring Events