File tree Expand file tree Collapse file tree 3 files changed +20
-46
lines changed Expand file tree Collapse file tree 3 files changed +20
-46
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -34,13 +34,18 @@ Usage
3434
3535## Method One (方式一,推荐)
3636
37- you need to include it in config in bootstrap section :
37+ you need to include it in config:
3838
3939``` php
4040return [
41- 'bootstrap' => [
42- 'yiier\returnUrl\EventBootstrap',
43- ],
41+ 'on beforeAction' => function ($event) {
42+ Yii::createObject([
43+ 'class' => \yiier\returnUrl\ReturnUrl::class,
44+ 'uniqueIds' => ['site/qrcode', 'site/login', 'site/signup']
45+ ])->beforeAction();
46+ },
47+ 'components' => [
48+ ]
4449];
4550```
4651
Original file line number Diff line number Diff line change 99namespace yiier \returnUrl ;
1010
1111use Yii ;
12- use yii \base \ActionFilter ;
12+ use yii \base \Behavior ;
13+ use yii \web \Controller ;
1314
14- class ReturnUrl extends ActionFilter
15+ class ReturnUrl extends Behavior
1516{
1617 /**
1718 * @var array
1819 */
1920 public $ uniqueIds = ['site/login ' ];
2021
22+ public function events ()
23+ {
24+ return [
25+ Controller::EVENT_BEFORE_ACTION => 'beforeAction ' ,
26+ ];
27+ }
28+
2129 /**
22- * @param \yii\base\Action $action
2330 * @return bool
2431 * @throws \yii\base\InvalidConfigException
2532 */
26- public function beforeAction ($ action )
33+ public function beforeAction ()
2734 {
2835 if (Yii::$ app ->user ->isGuest ) {
2936 if (!(Yii::$ app ->request ->getIsAjax () || $ this ->isValidate ())) {
You can’t perform that action at this time.
0 commit comments