Example #1
0
 /**
  * Delete a role
  */
 public function actionDeleteitem()
 {
     $id = Yii::$app->request->post('id');
     $model = LetAuthItem::find()->where('name = :id', [':id' => $id])->one();
     if ($model === null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     echo $model->delete() ? 1 : 0;
 }
Example #2
0
 public function search($params)
 {
     $query = LetAuthItem::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['type' => $this->type, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'rule_name', $this->rule_name])->andFilterWhere(['like', 'data', $this->data]);
     return $dataProvider;
 }