How do you use frontend/models and backend/models in yii2-advanced?

my model is basically in common/models, so I feel that frontend/models and backend/models directories are useless. Did you all use it?

Apr.09,2022

do not use model in direct use commom under frontend and backend. To establish model classes under frontend/models and backend/models , respectively, inherit common/models , and then use.

ide/2.0/structure-models-sharpbest-practices" rel=" nofollow noreferrer "> https://www.yiichina.com/doc/...

in the advanced application template, you can define a model base class common\ models\ Post , and then in the foreground application, define and use a specific model class that inherits common\ models\ Post frontend\ models\ Post . In the background application, you can similarly define backend\ models\ Post . Through this strategy, you know that frontend\ models\ Post only corresponds to the foreground application, and if you modify it, you don't have to worry about the modification affecting the background application.

I also write it all in common/models, which is common in front and background and easy to use.

Menu