Answer the question
In order to leave comments, you need to log in
How to pass controller name in router.php?
Router.php has:
$this->resource('/path/settings', 'Path\Settings');
$this->resource('/path/users', 'Path\Users');
$this->resource('/path/plugins', 'Path\Plugins');
Answer the question
In order to leave comments, you need to log in
$pathResources = [
'settings',
'users',
'plugins',
];
foreach ($pathResources as $pathResource) {
$this->resource('/path/' . $pathResource, 'Path\\' . ucfirst($pathResource));
}
This is a perversion, so I have not seen a ready-made solution for such purposes.
So just google dynamic route controller or something like that, see how routes work, and reinvent your wheel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question