How to redirect with a variable in the route:
$id = 8;
return redirect('/userpage/{$id}');
The route:
Route::get('/userpage/{id}', 'UserController@userpage');
The controller:
public function userpage($id)
{
return $id;
}
This displays {$id}.