public function actionSave($id) { $data = Yii::$app->request->post(); $delivery = Delivery::findOne($id); $delivery->name = $data['name']; $delivery->address = $data['address']; $delivery->location = $data['location']; $delivery->comment = $data['comment']; $delivery->save(); }
/** * Finds the Delivery model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Delivery the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Delivery::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }