Skip to content

Dynamic Routes #102

Answered by DavidPower
DavidPower asked this question in Q&A
Discussion options

You must be logged in to vote

Figured this out with a little help from @gaetanodegennaro. Here's how to make this method work. (NB: Step 2 was key for me).

  1. Define a parameter in your route definition (i.e. web.php) in the following format: Route::webhooks('mypath/{id}', 'config-name');

  2. IMPORTANT: Update VerifyCsrfToken.php to include a wildcard asterisk symbol at the end of your excluded route as follows:

protected $except = [
//
'mypath/*',
];
  1. Access the parameter in your ProcessWebhookJob.php as follows:

$id = Route::current()->parameter('id');

Many thanks to @gaetanodegennaro for the initial clues.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by DavidPower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #101 on September 06, 2021 17:11.