Is a good idea have a BaseController and make all controllers extend that class?

后端 未结 4 879
粉色の甜心
粉色の甜心 2020-12-20 06:13

I need some common behaviors in all controllers. Is a good idea have a BaseController and make all controllers extend that class? If so, What is the correct way to avoid the

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-20 06:39

    No, don't do that. Use action helpers to add functionnality to your controller. If you use a base controller, it will quickly become complicated and unsable. Action helpers allow more flexibility.

提交回复
热议问题