/**
  * Updates an existing Hoadon model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $list = Khachhang::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect('http://localhost/basic/web/index.php?r=hoadon%2Findex');
     } else {
         return $this->render('update', ['model' => $model, 'list' => $list]);
     }
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Khachhang::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id_khachhang' => $this->id_khachhang, 'record_status' => $this->record_status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone]);
     return $dataProvider;
 }
Exemplo n.º 3
0
 /**
  * Lists all Khachhang models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Khachhang::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Exemplo n.º 4
0
 public function actionIndex()
 {
     $lst = Khachhang::find()->where(['between', 'status', 1, 4])->all();
     //var_dump($lst);die;
     return $this->render('index', ['lst' => $lst]);
 }