Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

justdanfoust's avatar

How to access a url token for password reset?

I am inserting a token into the database and including it in the reset link. For the showResetForm(), I want to check the value in the URL against database values. If URL token doesn't match any tokens in the password_resets table, the page simply redirects and will not even show the form.

How would I go about doing this in Laravel? Traditionally I would just access $_GET[value] or explode the URL into an array and access the desired element.

0 likes
1 reply
justdanfoust's avatar
justdanfoust
OP
Best Answer
Level 1

Okay I was looking over some other code and found that all I have to do is pass an argument to the controller method and Laravel automatically grabs the 3rd URL parameter!

Example.

site.com/password/reset/fjgngdymgkg

public function showResetForm($id)
    {
      dd($id);          // Returns fjgngdymgkg
    }

Please or to participate in this conversation.