Q:

Laravel route with parameters

Am using laravel route for approving some form from email.
So i have encrypted some variables and created link 
which is like 
<a href="http://localhost/travel/tr/approveRequest?id=<?=$Encoded_travelRq_id?>&gsID<?=$Encoded_emp_gslab_id?>&decrypt<?=$Encoded_iv?>/">Approve</a>;

now how route can be written for this on laravel side in which i can seperate the variables like id, gsID, decrypt from url and can send to controller's function used against that route? 

A:

Usually I use two ways:
1º way:
The route:
Route::get('approveRequest', 'ApproveController@approve');

The controller:
public function approve (Request $request) {
    $var1 = $request->input('var1');
    $var2 = $request->input('var2');

    (...) do something with $var1 and $var2
}

2º way:
The route:
Route::get('approveRequest/{var1}/{var2}', 'ApproveController@approve');

The controller:
public function approve ($var1, $var2) {

    (...) do something with $var1 and $var2: they already have a instance
}

Good Luck! I hope be useful.

A:

Simply write a GET route to approveRequest :
Route::get('approveRequest', 'ApproveController@approve');

Because you are using URL parameters, you can simply get them in the approve() function like this
public function approve(Request $request) 
{
     $id = $request->id;
     $gsID = $request->get('gsID');
     .... and so on for all your variables.
}

With this approach the order of parameters does not matter.

