0

So i've got a form on my page /post-form The /post-form page also has parameters in it's URL like this /post-form?token={randomtoken}

I want it so that when I click on the submit button on the form I get the value of the token parameter. My route looks like this

Route::post('/post-form', 'PostFormController@post')->name('post');

This is the action that happens when I click on the submit button on the form. Does anyone know how to get the token parameter in the post function in my PostFormController?

2
  • 1
    have you tried $token = request('token');? Commented Apr 25, 2020 at 20:42
  • @porloscerrosΨ I tried that but it's returning nothing so that's why I asked here Commented Apr 25, 2020 at 20:48

2 Answers 2

0
public function post(Request $request){
  $token =$request->query('token');
}

you can see more requests Laravel Docs

Sign up to request clarification or add additional context in comments.

2 Comments

It's still giving me nothing in return.
@Max is your server nginx ? or you work with laravel artisan?
0

Try something like:

$token = $request->input('token');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.