How do I add a dynamic route requirement to a Bolt route.
I'm defining my route as follows:
formpages:
path: '/{contenttypeslug}/{slug}'
defaults:
_controller: 'Bolt\Extension\Mahango\Forms\Extension::record'
requirements:
contenttypeslug: 'page'
slug: 'Bolt\Extension\Mahango\Forms\Extension\Routing::getSlugRequirement'
In my getSlugRequirement()
method I want to query the database to get a subset of page records but I don't have access to the $app
var when the method is being called.
I've looked at the core code and tried to use $app->mount('', new Bolt\Extension\Mahango\Forms\Extension\Routing());
in my bootstrap.php
but here the extension hasn't yet been initialised.
How can I do get this to work?