1.

What is the purpose of ”beforeRender()”, “beforeFilter()”, and “afterFilter()” functions in Controller?

Answer»
  • beforeFilter(): This function will be executed before each action in the controller. It will inspect user PERMISSIONS or check for an active session.
  • beforeRender(): This function will be executed before the RENDERING of the view and immediately after controller action logic. This function will not be frequently used, but it might be needed if you MANUALLY call the render() function before the end of a GIVEN action.
  • afterFilter(): This function will be called after each controller action, and also after the completion of rendering. It is the last METHOD in the controller to run.


Discussion

No Comment Found