/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = organisasi::find()->where('STATUS <> 3')->orderBy('parent', 'title'); $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, 'parent' => $this->parent, 'itemType' => $this->itemType, 'UPDATED_TIME' => $this->UPDATED_TIME, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]); return $dataProvider; }
/** * Finds the organisasi model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return organisasi the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = organisasi::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }