示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Artikel::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' => $this->id, 'author' => $this->author, 'categori_id' => $this->categori_id, 'schedule_date' => $this->schedule_date, 'status' => $this->status, 'viewed' => $this->viewed, 'user_create' => $this->user_create, 'user_update' => $this->user_update, 'date_create' => $this->date_create, 'date_update' => $this->date_update]);
     $query->andFilterWhere(['like', 'judul', $this->judul])->andFilterWhere(['like', 'summary', $this->summary])->andFilterWhere(['like', 'deskripsi', $this->deskripsi])->andFilterWhere(['like', 'author_name', $this->author_name])->andFilterWhere(['like', 'categori_name', $this->categori_name])->andFilterWhere(['like', 'sumber', $this->sumber])->andFilterWhere(['like', 'image1', $this->image1])->andFilterWhere(['like', 'image2', $this->image2])->andFilterWhere(['like', 'image3', $this->image3])->andFilterWhere(['like', 'image4', $this->image4])->andFilterWhere(['like', 'image5', $this->image5])->andFilterWhere(['like', 'image6', $this->image6])->andFilterWhere(['like', 'image7', $this->image7])->andFilterWhere(['like', 'image8', $this->image8])->andFilterWhere(['like', 'image9', $this->image9])->andFilterWhere(['like', 'video', $this->video])->andFilterWhere(['like', 'user_by', $this->user_by]);
     return $dataProvider;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArtikel()
 {
     return $this->hasOne(Artikel::className(), ['id' => 'artikel_id']);
 }