Application with division into branches

Hi!

I have to create application with Yii2 to manage some shops. The goal is to create app with division into branches. I want to have all models connected with branch with branch_id. User has to have option to switch branch and than see ie. products only from selected branch. Yes I know that I can do it manually on every action. But how to achieve it automatically? In my Yii 1.1 app I was using BeforeFind() and there I was adding extra condition. How can I achieve this in Yii2? What’s more I need to have some “global” models ie. User

Thank’s for all advices