Skip to content

Instantly share code, notes, and snippets.

@o-shabashov
Created May 29, 2016 22:50
Show Gist options
  • Save o-shabashov/092a718adaf8a362f3cf8684626668e7 to your computer and use it in GitHub Desktop.
Save o-shabashov/092a718adaf8a362f3cf8684626668e7 to your computer and use it in GitHub Desktop.
Yii2 redirect to remembered URL
<?php
// Stored in session
Url::remember(['brands/vanity-iew', 'brand' => $brand->vanity_url], 'return-url');
// Redirect if exist
if (Url::previous('return-url')) {
return $this->redirect(Url::previous('return-url'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment