Calling a method from another controller

后端 未结 4 743
逝去的感伤
逝去的感伤 2020-12-04 18:09

If I\'ve got a method in a different controller to the one I\'m writing in, and I want to call that method, is it possible, or should I consider moving that method to a help

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 18:42

    If you requirement has to Do with some DB operations, then you can write a common function (class method) inside that Model. Functions defined inside model are accessible across to all the controllers. But this solution does to apply to all cases.

提交回复
热议问题