Moutinho
Moutinho

Reputation: 349

MVC - Yii2 reorganize my code structure from backend to frontend

in my company i have one app with Yii2 Framework (MVC) divided between frontend and backend, some people use frontend and others use backend. Now i need (by the reason of integrity and ease of access of users) integrate all in frontend (leave backend only for the admnistrators).

For example i have one module like a "Call Center" where only the telephonists save the calls in backend. So in frontend (with diferent layout, permissions, fields, filters etc..) the others users see, edit and work yours calls. Now i need pass the module "call center" from backend (where only telephonists have access) to frontend.

What the best way organize my code? I thought to assing one "suffix" for de code comming from backend and organize my code like this:

Controllers

 CallCenterController.php
 CallCenterAdmin.php

Views

call-center
   index.php
   view.php

call-center-admin
   index.php
   view.php
   form.php

Is this correct? Or thes best solution is one controller and one folder with views for module "call-center" unique? My objetive is change easyly permissions, layout, visible fields, filters etc..

Upvotes: 0

Views: 82

Answers (1)

user7997307
user7997307

Reputation:

Your question is your answer. You can create structure of your project on application level, not module level, with splited authorization, configs & web/index.php for example:

site:
--common
--console
--call-center:
---web:
----index.php
---views
---etc
--call-center-admin:
---web:
----index.php
---views:
---etc

Upvotes: 0

Related Questions