Keeps current URL in session for controller actions so we can return to it if needed.
This is Yii2 port of set-return-url-filter extension.
In "composer.json" your project, add the following lines:
"require": {
...
"dlds/yii2-return-url": "*"
},
Then update your project:
php composer.phar update --prefer-dist
In your controller add ReturnUrl filter to behaviors:
public function behaviors()
{
return [
'returnUrl' => [
'class' => 'dlds\returnUrl\ReturnUrl',
],
];
}
For access to previously visited url:
Yii::$app->user->getReturnUrl();
yii2-return-url is released under the BSD License. See LICENSE.md file for details.