Closed leyestd closed 4 years ago
You need to be careful where you add the code in the config files
I have currently set it up as follows:-
I have tried adding module only to the backend, but for some reason it does not seem to work. So I just add it to common config file. But you have to sure that you add 'as access' to frontend as well to allow only guest pages
I hope this makes sense.
thanks
@varun7387 as i setup the mdm admin module in backend application i cannot see the frontend routes. is it possible to view all the routes of frontend in backend i want to control my frontend from backend .
@gauravparashar12 No, its imposible.
@mdmunir Is it possible to assign routes to specific users. If, it is. Then please let me know what will be the correct way of doing the same.
@gauravparashar12 You also cannot directly assign routes to user. You must create permision
, permision
has routes
, and user has permision
.
@mdmunir thanks for the solution for specific route to particular user , but I am stucked in a problem where i created half of my controllers in backend and half in frontend but all things can be managed by backend only please provide me the way how i can implement this or is i have to merge all controllers in one application then what is the best way ?
when I add the admin to bootstrap I get the following error:
Unknown bootstrapping component ID: admin
only works when i have
'bootstrap' => ['log'],
any suggestion??
thanks
@mdmunir concerning the backend-and-frontend-routes-problem mentioned by @gauravparashar12, how about we implement the solution from this stackoverflow post: https://stackoverflow.com/questions/32777923/get-modules-structure-in-yii2-advanced-template
In short you could get all the modules like this: $config = yii\helpers\ArrayHelper::merge( require(DIR . '/../../../common/config/main.php'), require(DIR . '/../../../common/config/main-local.php'), require(DIR . '/../../../frontend/config/main.php'), require(DIR . '/../../../frontend/config/main-local.php'), require(DIR . '/../../../backend/config/main.php'), require(DIR . '/../../../backend/config/main-local.php') ); $modules = array_keys($config['modules']);
Then use this within your RouteController::getAppRoutes() method to get all routes. $config could be a module property which is customizable for every Yii2 app structure. As a default you could revert to Yii::$app as you currently do.
Cheers
Kai
Hi @firefox747, can you explain the method you mentioned above step by step? Thank you.
@RGTimothy sorry for my late reply. Was busy on other things the late months. I have uploaded a possible solution for yii2-admin and yii2-advanced-template. See https://github.com/mdmsoft/yii2-admin/pull/309
@gauravparashar12 click refresh button because cache
@firefox747 so which file should I edit to add these code? Thank you
What should I pay attention, in which the file configuration