Answer the question
In order to leave comments, you need to log in
Inherit Yii2 controller?
I am changing, I have already asked a similar question, but not in detail - and of course I did not receive a proper answer.
There is ONE controller ' main '
There are 2 roles that use this controller.
1. The role of the employee
2. The role of the field employee
The task is as follows:
Both roles are loaded by one controller, but the actions of the roles are different, and the action actions are different for both roles. Model naturally in action are loaded different.
It turns out that I need to break this controller into sub-controllers with the necessary actions.
How can I do this in Yii2?
Also, for clarification:
MainController Employee
role:
actionIndex, actionIssued,actionNew
Model app
Field worker role:
actionIndex, actionIssuedHome, actionNewHome
Model appHome
Hope it helps
Answer the question
In order to leave comments, you need to log in
I'll write again...
you have 1 controller.. check what role you have.. and call this or that code..
respectively, the code can be taken into the model.. and only return data from it... and display them accordingly. ..
everything seems to be simple, what confuses you or what is not clear to you?
do actionNew (for BOTH ROLES)
then check for the role .. and then build the logic .. what don't you like here?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question