CodeIgniter Forums
One model for user and admin - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: One model for user and admin (/showthread.php?tid=3888)



One model for user and admin - El Forum - 10-27-2007

[eluser]masterix[/eluser]
Hi,

Is it a good idea to have only one model for user and admin? Let's say it is news model nad the are methods like news acceptation, getting last x news, deleting news and so on.

I'm waiting for your answers and advice Wink


One model for user and admin - El Forum - 10-27-2007

[eluser]Lockzi[/eluser]
I'm far from an experienced developer but I was going to say split it up... But then I figured it basically depends on how your administration part is going to look like and be used... You might be using the same/similar codes for listing news and such which would kind of be against the DRY (Don't Repeat Yourself) and the MVC logic.

I would say do as you wish, since, from my limited experience, I can't see any problem with either.

Regards,
Lockzi


One model for user and admin - El Forum - 10-27-2007

[eluser]Référencement Google[/eluser]
For my experience, I am used to keep all relative datas in one model.


One model for user and admin - El Forum - 10-27-2007

[eluser]Rick Jolly[/eluser]
Another vote for 1 model. The controllers should be able to handle the access permissions.


One model for user and admin - El Forum - 10-27-2007

[eluser]Eric Barnes[/eluser]
I will vote for one model as well. However it should be kept simple and not a 10gb file. Wink


One model for user and admin - El Forum - 10-28-2007

[eluser]masterix[/eluser]
Thanks for your replies Smile

It wouldn't be a 10gb file - there are only 10-15 methods to keep so I think one model is comfortable and acceptable solution.