Exemple #1
0
 public function actionDelete($id)
 {
     $user = Khachhang::findOne($id);
     if (!empty($user)) {
         $user->status = 0;
         if ($user->save()) {
             return $this->redirect('?r=khachhang/index');
         }
     }
 }
 /**
  * Finds the Khachhang model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Khachhang the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Khachhang::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionPreview($id)
 {
     $model = Khachhang::findOne($id);
     return $this->render('preview', ['model' => $model]);
 }