I have a funcionallity named “Tasks” divided with two parts. The part one with acess for all users, and the part two with similar funcionality, different layout and restricted for a specific users.
All of this in frontend. What the best way to organize my code?
Create one controller for the part one and other controller for the part two, and two folders for views.
Or other structures for organize my code?
The “Tasks” is one example i have multiple cases of this.
Depends on if these two functionalities are going to be developed differently. If they likely will, having a copy is fine. It won’t be a copy soon.
If these are going to stay the same forever a parent-controller with protected methods should be OK.
@samdark yes these are developed differently.
For you is not confused work with the example i refer?
Adding all time one “suffix” for the similar funcionallity?
another example is:
You can use modules for such separation.
Ok, so my code would look like this correct @samdark ?
Yes. I’d get TaskOne into taskOne module and TaskTwo into taskTwo module.
why? I did not understand? why get taskOne in module?
Because these are two separate groups of related functionality. You can, of course, keep one of these out of the module.