/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = NotifyEmail::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(['ne_id' => $this->ne_id, 'mc_id' => $this->mc_id, 'staff_id' => $this->staff_id]); $query->andFilterWhere(['like', 'staff_email', $this->staff_email])->andFilterWhere(['like', 'attachment', $this->attachment]); return $dataProvider; }
public function getNotifyEmail() { return $this->hasMany(NotifyEmail::className(), ['staff_id' => 'staff_id']); }
/** * Finds the NotifyEmail model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return NotifyEmail the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = NotifyEmail::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }