Dynamic return page
// Store return URL, just before return to update view.
Yii::$app->user->returnUrl = Yii::$app->request->referrer;
// return to saved URL
$returnUrl = Yii::$app->user->returnUrl ?: ['/aaa/bbb', 'id' => $id]; // if not saved go to default
return $this->redirect($returnUrl);
x