Example #1
0
 public function actionAllAjax()
 {
     if (Yii::$app->request->isAjax) {
         echo Json::encode(Writer::find()->asArray()->all());
     } else {
         echo "0";
     }
 }
Example #2
0
 public function search($params)
 {
     $query = Writer::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }