File tree 2 files changed +20
-2
lines changed 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ public function packageBooted()
27
27
throw InvalidMethod::make ($ method );
28
28
}
29
29
30
- return Route::{$ method }($ url , '\Spatie\WebhookClient\Http\Controllers\WebhookController ' )->name ("webhook-client- {$ name }" );
30
+ return Route::{$ method }($ url , '\Spatie\WebhookClient\Http\Controllers\WebhookController ' )
31
+ ->name ("webhook-client- {$ name }. " . Str::random (8 ));
31
32
});
32
33
33
34
$ this ->app ->scoped (WebhookConfigRepository::class, function () {
@@ -43,7 +44,9 @@ public function packageBooted()
43
44
$ this ->app ->bind (WebhookConfig::class, function () {
44
45
$ routeName = Route::currentRouteName () ?? '' ;
45
46
46
- $ configName = Str::after ($ routeName , 'webhook-client- ' );
47
+ $ routeNameSuffix = Str::after ($ routeName , 'webhook-client- ' );
48
+
49
+ $ configName = Str::before ($ routeNameSuffix , '. ' );
47
50
48
51
$ webhookConfig = app (WebhookConfigRepository::class)->getConfig ($ configName );
49
52
Original file line number Diff line number Diff line change @@ -204,6 +204,21 @@ public function it_can_store_none_of_the_headers()
204
204
$ this ->assertEquals (0 , count (WebhookCall::first ()->headers ));
205
205
}
206
206
207
+ /** @test */
208
+ public function multiple_routes_can_share_configuration ()
209
+ {
210
+ Route::webhooks ('incoming-webhooks-additional ' );
211
+
212
+ $ this ->refreshWebhookConfigRepository ();
213
+
214
+ $ routeNames = collect (Route::getRoutes ())
215
+ ->map (fn ($ route ) => $ route ->getName ());
216
+
217
+ $ uniqueRouteNames = $ routeNames ->unique ();
218
+
219
+ $ this ->assertEquals ($ routeNames ->count (), $ uniqueRouteNames ->count ());
220
+ }
221
+
207
222
protected function determineSignature (array $ payload ): string
208
223
{
209
224
$ secret = config ('webhook-client.configs.0.signing_secret ' );
You can’t perform that action at this time.
0 commit comments