Can one controller point to different models? |
[eluser]Unknown[/eluser]
Hello everyone, i am currently developing a login and registration system, The login system(its own controller, model and view) includes function such as: validate, if_uname_exists, if_email_exists, etc registration system(its own controller, model and view) includes functions: register,send_activation,send_email, etc However i have a need to make a user controller, which has the username as a data member, and i need to call on functions such as <i>is_admin(), update_profile()</i>. So my doubt is, should those functions be included a user model, or rather can i have them in another model, for example: login model or maybe a profile model? Are there any best practices to follow on the same? Thanks alot
[eluser]phpkode[/eluser]
I have seen a good article on this. Here the user extends Admin_Controller, User_Controller etc. (which does checks like - is logged in / getting current username etc). Then these Controllers are extended instead of CI_Controller http://jondavidjohn.com/blog/2011/01/sca...r-ion_auth Although he has used Ion Auth, you can use your own system with a little work (anyway the logic remains the same)
[eluser]jairoh_[/eluser]
you can have BaseModel or parent model that your models will extend to. |
Welcome Guest, Not a member yet? Register Sign In |