/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Patientimage::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(['width' => $this->width, 'height' => $this->height, 'capture_date' => $this->capture_date]); $query->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'image_name', $this->image_name])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'hos_guid', $this->hos_guid])->andFilterWhere(['like', 'hos_guid_ext', $this->hos_guid_ext]); return $dataProvider; }
/** * Finds the Patientimage model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $hn * @param string $image_name * @return Patientimage the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($hn, $image_name) { if (($model = Patientimage::findOne(['hn' => $hn, 'image_name' => $image_name])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getPatientimage() { return $this->hasOne(Patientimage::className(), ['hn' => 'hn']); }
/** * Displays a single Vnstat model. * @param string $id * @return mixed */ public function actionGetimage($hn) { $picture = new Patientimage(); $myModels = $picture->findOne(['hn' => $hn]); return $this->renderPartial('./getimage', ['model' => $myModels]); }