In Yii2, if you want to execute certain logic before the specific operation method, what should you do?
The current approach is to extract a basic controller and write it in the beforeAction inside.
I would like to ask if it can be configured through the configuration file and how to configure it.
Thank you
In Yii2, if you want to execute certain logic before the specific operation method, what should you do?
The current approach is to extract a basic controller and write it in the beforeAction inside.
I would like to ask if it can be configured through the configuration file and how to configure it.
Thank you
Resolved
<code>$params = array_merge( require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/params-local.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/params-local.php') ); return [ 'id' => 'back-frontend', ... 'components' => [ ... ], 'on beforeAction' => [ \frontend\behaviors\CheckPermission::className(), 'kunxTest', ], ... ];</code>
Content comes from: link description