How to pass parameters to controller in FastRoute?

642 Views Asked by At

I did not find anything related to Lumen (not Laravel) for passing value to controller. Is my approach wrong or am I just missing the obvious ?

I want to pass a parameter to controller, not talking about the {name} in localhost:8000/someprefix/{name}. As lumen is using FastRoute and I do not want to change back to default router. I want to pass value to the controller as method parameter ? Any help will be appreciated.

web.php

// $value has the method
// I want to pass the $myParameter value to below mentioned statement ?
// and receive it as parameter in **methodNotAllowedHere()** in the controller
$myParameter = 10;
$router->addRoute($value, '/signup', 'UserController@methodNotAllowedHere');

UserController.php

// i want to receive $myParameter as  $value 
public function methodNotAllowedHere( $value = '' ) {
    return $value;
}
0

There are 0 best solutions below