2
I need to check a certain type of permission that is in the permissions table in the MYSQL database. In this case, I will need to use a function that is inside the "Libraries" folder in a file called "functions.php".
The purpose of this function is only to check if the user has access to specific buttons within a given "view". If it shows the related buttons.
So what is the most appropriate way forward?
- Create a "model" and call it in my function that is inside the folder "Libraries" in a file called "functions.php".
- Do the query directly inside the function that is inside the "Libraries" folder in a file called "functions.php".
I confess that it is tempting to use the second option but I do not want to hurt the standard "mvc". I’ve seen many people on the Internet create queries within functions that do not belong to the model or controller.
I’d like to know your opinion.
I don’t know exactly how your code is but try not to violate the SOLID SRP principle.
– rray
The question is plausible. It may be poorly expressed, but I fully understood the user737’s doubt. The answer is very objective
– Guilherme Viebig
Though I don’t understand bulhuffles codeigniter, it seems to me to be a question responsive yes.
– talles
Whoever rewrote my question made things worse! Even I don’t understand that there they wrote!!!!
– user737