/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TblClassroomSetup::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->joinWith('statuS'); $query->joinWith('classroom'); $query->andFilterWhere(['form_id' => $this->form_id, 'user_id' => $this->user_id, 'form_type' => $this->form_type, 'setup_type' => $this->setup_type, 'closed_by' => $this->closed_by, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'update_date' => $this->update_date, 'assigned_to' => $this->assigned_to, 'setup_time' => $this->setup_time, 'pickup_time' => $this->pickup_time, 'scheduled_start_time' => $this->scheduled_start_time, 'scheduled_end_time' => $this->scheduled_end_time]); $query->andFilterWhere(['like', 'setup_other', $this->setup_other])->andFilterWhere(['like', 'inventory', $this->inventory])->andFilterWhere(['like', 'comments', $this->comments])->andFilterWhere(['like', 'classroom_other', $this->classroom_other])->andFilterWhere(['like', 'course_code', $this->course_code])->andFilterWhere(['like', 'tbl_statuses.status_name', $this->status])->andFilterWhere(['like', 'tbl_classroom.classroom_name', $this->classroom]); return $dataProvider; }
/** * Finds the TblClassroomSetup model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TblClassroomSetup the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TblClassroomSetup::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }