From de63c8733eec76c1af1dc07f952b8ffc74706675 Mon Sep 17 00:00:00 2001 From: Adnan Hussain Turki Date: Wed, 3 Feb 2021 05:59:16 +0530 Subject: [PATCH] Fix VerifyCSRF --- src/Routes/SlackRoute.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Routes/SlackRoute.php b/src/Routes/SlackRoute.php index 388351b..a07e1df 100644 --- a/src/Routes/SlackRoute.php +++ b/src/Routes/SlackRoute.php @@ -9,8 +9,13 @@ use myPHPnotes\Slacker\Controllers\Messages\MessagesController; use myPHPnotes\Slacker\Controllers\Webhooks\WebhooksController; -class SlackRoute extends \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken { +class SlackRoute { + protected $router; + public function __construct(Router $router) + { + $this->router = $router; + } public static function routes($prefix = "slacker") { Route::get($prefix . '/dashboard', [DashboardController::class, 'index'])->name('slacker.dashboard'); @@ -26,7 +31,9 @@ public static function routes($prefix = "slacker") Route::get($prefix . '/channel/{webhook}/webhook/delete', [WebhooksController::class, 'delete'])->name('slacker.channel.webhook.delete'); - Route::post($prefix . '/{webhook}/webhook', [WebhooksController::class, 'listen'])->name('slacker.channel.webhook.listen'); + $this->router->group(['middleware' => ['web'], function ($router) { + $router->post($prefix . '/{webhook}/webhook', [WebhooksController::class, 'listen'])->name('slacker.channel.webhook.listen'); + } } }