I am using lumen 7 framework. I had a bug. In the web.php file I put:
$router->get('/getAll/{param1:[0-9]+|2A|2B}/{param2:[0-9]+}', 'TestController@getAll');
So, in the TestController, I create the function like that :
public function getAll($param1, $parm2)
{
....
}
The isssue is :
Illuminate\Contracts\Container\BindingResolutionException: Unable to resolve dependency [Parameter #1 [ $param2 ]] in class App\Http\Controllers\TestController
I did some tests, I add this bloc to provider, but it didn't work.
$this->app->singleton(\Illuminate\Contracts\Routing\ResponseFactory::class, function() {
return new \Laravel\Lumen\Http\ResponseFactory();
});
Also, I checked if I had done something wrong in the web.php file but I changed the function in the controllers to :
public function getAll($param1)
{
$parm2=1;
....
}
and it works fine.
How can I fix this bug, because in the url I need the two params. Thanks,