public function searchMinhasFrequencias($params) { $query = Frequencia::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; } $aluno = Aluno::findOne(['CPF' => Yii::$app->user->identity->login]); $monitoria = Monitoria::findOne(['IDAluno' => $aluno->ID]); $query->andFilterWhere(['ID' => $this->ID, 'IDMonitoria' => $monitoria->ID, 'dmy' => $this->dmy, 'ch' => $this->ch, 'atividade' => $this->atividade]); $query->orderBy(['ID' => SORT_DESC]); return $dataProvider; }
/** * Finds the Monitoria model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Monitoria the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Monitoria::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('A página requisitada não existe.'); } }