I have controller file called Authorize.php, in this file i have check either the user is allowed to make request and i have other controller files like products.php and etc, i would like to call Authorize.php file in products.php or want to call Authorize function in my other controller files.

I would like to know, what will be the way to do so.

  • I think best way is to define your method into helper class and call it into your controller or where you need it ref – Hitesh Oct 29 '18 at 12:36
  • 1
    you can check it with either predispatch or postdispatch method availabe for any controller – Zaheerabbas Oct 29 '18 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.