v2.0.7
You can now pass arguments to middleware methods
When working with middleware methods you can also pass them arguments if you need to
$routes
->middleware([
'test_middleware',
'has_roles' => 'admin,user',
[ Middleware::class, 'test_method' ],
[ Middleware::class, 'has_role', 'Admin', 'Moderator', [ 'User', 'Bot' ] ],
])
->add('/test', function (Request $request) {
$request->send([ 'msg' => 'testing' ]);
});
Every middleware function can also accept an argument of type Gac\Routing\Request
at any position as long as it has the proper type specified.