Max
Max

Reputation: 367

Laravel post url parameters

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?

Upvotes: 0

Views: 238

Answers (2)

Elvis Sylejmani
Elvis Sylejmani

Reputation: 106

Try something like:

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

Upvotes: 0

Mortada Jafar
Mortada Jafar

Reputation: 3689

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

you can see more requests Laravel Docs

Upvotes: 0

Related Questions