2

I want to build an admin panel for my small application, what approach should I use?

  1. Should I write another admin controller in the application controllers folder?
  2. Or should I follow some other approach which is good for big projects too?
Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
user_quest
  • 205
  • 1
  • 4
  • 8

3 Answers3

5

Here is related question And here are 2 ways to create admin area.

Community
  • 1
  • 1
yAnTar
  • 4,269
  • 9
  • 47
  • 73
1

Having another controller is fine -- I usually create a base admin controller Admin_Controller extending CI_Controller, and then all my admin-related controllers extends that base admin controller.

Calvin
  • 8,697
  • 7
  • 43
  • 51
  • I find this post a good place to start http://jondavidjohn.com/blog/2011/01/scalable-login-system-for-codeigniter-ion_auth – danneth Jul 25 '12 at 11:31
0

If you're already using the MVC architecture then it makes sense to stick with it, doesn't it? I see no reason why the administration actions of your 'admin panel' can't fit into it.

However, I would say that an "admin controller" sounds like a great deal of responsibility for one controller! Ideally I would argue that your controllers should be nice and thin, with few responsibilities. It's hard to say without knowing what you're working with though, I'd definitely look at what your admin panel will contain and split out the responsibilities into a number of categories, actions, responsibilities, or something; creating an admin area containing several of these controllers. Perhaps they could all extend a base AdminController class?

Alexander R
  • 2,468
  • 24
  • 28