Esempio n. 1
0
 /**
  * Deletes an existing Address model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDefault($id)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     Address::updateAll(['default' => 0], ['user_id' => Yii::$app->user->id]);
     $model = $this->findModel($id);
     $model->default = 1;
     $model->save();
     return ['status' => 1];
 }