Skip to content

Commit

Permalink
Return the Route object for method chaining (#114)
Browse files Browse the repository at this point in the history
In Version 2 the macro returned the Route object, for example you could add a middleware:
```php
Route::webhooks('example')->middleware('auth.webhook');
```
This breaks with the update to v3. Simply returning the Object again solves this issue.
  • Loading branch information
erikwittek authored Dec 7, 2021
1 parent 0d128b7 commit d71a8e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/WebhookClientServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configurePackage(Package $package): void
public function packageBooted()
{
Route::macro('webhooks', function (string $url, string $name = 'default') {
Route::post($url, WebhookController::class)->name("webhook-client-{$name}");
return Route::post($url, WebhookController::class)->name("webhook-client-{$name}");
});

$this->app->singleton(WebhookConfigRepository::class, function () {
Expand Down

0 comments on commit d71a8e8

Please sign in to comment.