spatie / laravel-webhook-client

Receive webhooks in Laravel apps
https://freek.dev/1383-sending-and-receiving-webhooks-in-laravel-apps
MIT License
1k stars 147 forks source link

syntax error vendor/spatie/laravel-webhook-client/src/WebhookClientServiceProvider.php:28 #157

Closed jbov closed 2 years ago

jbov commented 2 years ago

I now receive this error on my local version after composer global update. Nothing changed in my code and everything worked properly before the composer update.

This is line 28: Route::macro('webhooks', fn (string $url, string $name = 'default') => Route::post($url, '\Spatie\WebhookClient\WebhookController')->name("webhook-client-{$name}"));

this is a laravel 6 project.

I get this error in artisan:

Symfony\Component\Debug\Exception\FatalThrowableError : syntax error

at /Users/.../Sites/ws/vendor/spatie/laravel-webhook-client/src/WebhookClientServiceProvider.php:28 24| DIR.'/../database/migrations/create_webhook_calls_table.php.stub' => database_path("migrations/{$timestamp}_create_webhook_calls_table.php"), 25| ], 'migrations'); 26| } 27|

28| Route::macro('webhooks', fn (string $url, string $name = 'default') => Route::post($url, '\Spatie\WebhookClient\WebhookController')->name("webhook-client-{$name}")); 29| 30| $this->app->singleton(WebhookConfigRepository::class, function () { 31| $configRepository = new WebhookConfigRepository(); 32|

Exception trace:

1 Composer\Autoload\includeFile("/Users/..../Sites/ws/vendor/composer/../spatie/laravel-webhook-client/src/WebhookClientServiceProvider.php") /Users/..../Sites/ws/vendor/composer/ClassLoader.php:322

2 Composer\Autoload\ClassLoader::loadClass("Spatie\WebhookClient\WebhookClientServiceProvider")

Any clue as to how to fix this issue? Thank you. - Jon