Buttons Redirect
Example Buttons
//Cancel
<?= Html::a('Cancel', ['index'], ['class'=>'btn btn-primary', 'title'=> 'Mouse over Text',]) ?>
//Delete
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
'title' => 'Mouse Over Text',
],
]) ?>
Back Button
<?= Html::a( 'Cancel', Yii::$app->request->referrer , ['class'=>'btn btn-primary']); ?>
Redirect
return $this->goBack((!empty(Yii::$app->request->referrer) ? Yii::$app->request->referrer : null));
return $this->redirect(Yii::$app->request->referrer);
return $this->redirect(Yii::$app->request->referrer ?: Yii::$app->homeUrl);
return $this->goBack((!empty(Yii::$app->request->referrer) ? Yii::$app->request->referrer : null));