Class to run before all requests

Could you tell me, how can I create a class or a function, which will be run throughout the whole website before all requests? I need to build the menu of the website and there are counters of unread messages and topics and for that I need to check the session of the user and get his last visit.

You can use on beforeRequest

1 Like

Thanks! Seems like exactly what I need.