Silex Setting Middleware to a ControllerCollection -


i want this:

$app->mount('dashboard', new travel\controllers\dashboard())->before(function() use ($app) {               //check if logued...             }) 

is possible?

thanks!

you can

$controllers = $app["controllers_factory"]; $controllers->before(function(request $request){}); 

in controllerproviderinterface::connect method

if need function defined in $app definition php file can create protected function

$app['callback'] = $app->protect(function(){}); 

then

$controllers->before($app["callback"]); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -