我想这样做:
$app->mount('dashboard', new TravelControllersDashboard())->before(function() use ($app) {
//check if is logued...
})
有可能吗?
谢谢!
你可以做
$controllers = $app["controllers_factory"];
$controllers->before(function(Request $request){});
in you ControllerProviderInterface::connect
method
如果你需要在$app
定义php文件中定义一个函数,你可以创建一个受保护的函数
$app['callback'] = $app->protect(function(){});
然后$controllers->before($app["callback"]);