public function CUpdate() { // $cst = new Customers(); $cst = Customers::findOne($this->id); $cst = $cst->findOne($this->id); // VarDumper::dump($cst); $cst->name = $this->name; $cst->email = $this->email; $cst->mobile = $this->mobile; return $cst->save(); }
public function actionUpdate() { $mod = Customers::findOne($_GET['id']); if (Yii::$app->request->isPost) { $mod->load(Yii::$app->request->post()); // VarDumper::dump($mod); // $mod = new Customers(); $mod->CUpdate(); $this->redirect(array('/table/index')); } else { return $this->render('update', ['data' => $mod]); // throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
/** * Finds the Customers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Customers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Customers::findOne($id)) !== null) { $model->scenario = 'customerEdit'; return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionCustomer() { if (\filter_input(INPUT_POST, 'customer')) { $customer_id = filter_input(INPUT_POST, 'customer'); $model = Customers::findOne($customer_id); if (!empty($model)) { return $this->renderAjax('customer-details', ['model' => $model]); } } }