public function search($params) { $query = res::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_result' => $this->id_result, 'sumBones' => $this->sumBones, 'arrSumBones' => $this->arrSumBones, 'id_exp' => $this->id_exp]); $query->andFilterWhere(['like', 'Chance', $this->Chance]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getResults() { return $this->hasMany(res::className(), ['id_exp' => 'id_exp']); }
/** * Finds the res model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return res the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = res::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Displays a single exp model. * @param integer $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); $resultsProvider = new ActiveDataProvider(['query' => \app\models\res::find()->where(['id_exp' => $model->id_exp]), 'pagination' => ['pageSize' => 10]]); return $this->render('view', ['model' => $this->findModel($id), 'resultsProvider' => $resultsProvider]); }