From 4753fa0caa78882886cd85191c65f9a0b218390d Mon Sep 17 00:00:00 2001 From: Harish Toshniwal Date: Wed, 20 Nov 2019 00:37:01 +0530 Subject: [PATCH] v1.0.1 --- CHANGELOG.md | 3 +++ README.md | 8 ++------ src/AwsSnsServiceProvider.php | 5 ++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8439cd..1fe2587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ All the notable changes to the Laravel Aws Sns package are documented in this file: +## v1.0.1 (20-11-2019) +- Added `awsSnsWebhooks` route helper + ## v1.0.0 (18-11-2019) - Initial release diff --git a/README.md b/README.md index adedc28..1d36b00 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,10 @@ composer require joggapp/laravel-aws-sns - The package will automatically register itself. -- You can assign the AwsSnsController to any of your desired routes. The AwsSnsController is a single action controller, so all you have to assign is just the controller class to the route. Eg: +- You then need to pass the route to `awsSnsWebhooks`: ```php -use JoggApp\AwsSns\Controllers\AwsSnsController; - -... - -Route::post('webhooks/aws/sns', AwsSnsController::class); +Route::awsSnsWebhooks('route-you-added-in-aws-sns-topic-subscription-console'); ``` - The package emits 2 events: `SnsTopicSubscriptionConfirmed` & `SnsMessageReceived`. diff --git a/src/AwsSnsServiceProvider.php b/src/AwsSnsServiceProvider.php index 2ff4636..eeedeb0 100644 --- a/src/AwsSnsServiceProvider.php +++ b/src/AwsSnsServiceProvider.php @@ -2,13 +2,16 @@ namespace JoggApp\AwsSns; +use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; class AwsSnsServiceProvider extends ServiceProvider { public function boot() { - // + Route::macro('awsSnsWebhooks', function ($url) { + return Route::post($url, '\JoggApp\AwsSns\Controllers\AwsSnsController'); + }); } public function register()