frontend\controllers\OrderController::actionAddressAdd PHP Method

actionAddressAdd() public method

public actionAddressAdd ( )
    public function actionAddressAdd()
    {
        $model = new Address();
        $model->load(Yii::$app->request->post());
        if (Yii::$app->request->isAjax) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if (Yii::$app->request->isPost) {
            $model->user_id = Yii::$app->user->id;
            $model->save();
        }
        if (Yii::$app->request->referrer) {
            return $this->redirect(Yii::$app->request->referrer);
        } else {
            return $this->redirect(['index']);
        }
    }