Level 7
Ah, couldn't find this in the docs but solved it using
$router->get('api/benefits', [
'middleware' => 'client',
'uses' => 'BenefitsController@index'
]);
In Lumen, I have added middleware to my bootstrap/app
$app->routeMiddleware([
'client' => App\Http\Middleware\CheckHeaders::class,
]);
Added to the routes:
$router->get('api/benefits', ['middleware' => 'client'], 'BenefitsController@index');
I basically modified the example middleware already provided, so I'm at a loss as to whats wrong. The code I've added passes, then I assume when in the handle function, it does the
return $next($request);
It gives the error Undefined variable: closure .... in RoutesRequests.php (line 286)
Ah, couldn't find this in the docs but solved it using
$router->get('api/benefits', [
'middleware' => 'client',
'uses' => 'BenefitsController@index'
]);
Please or to participate in this conversation.