/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Courses::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(['credit_hours' => $this->credit_hours, 'level' => $this->level, 'dept_ID' => $this->dept_ID]); $query->andFilterWhere(['like', 'course_ID', $this->course_ID])->andFilterWhere(['like', 'course_name', $this->course_name]); return $dataProvider; }
public function getAll() { return ArrayHelper::map(Courses::find()->all(), 'id', 'courses'); }
public function actionVideo() { $courses = Courses::find()->orderBy(['id' => SORT_DESC])->all(); return $this->render('video', ['courses' => $courses]); }