/** * Finds the CriticsUser model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CriticsUser the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CriticsUser::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CriticsUser::find()->where('status=0'); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'cityId' => $this->cityId]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'fName', $this->fName])->andFilterWhere(['like', 'lName', $this->lName])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'profileImage', $this->profileImage])->andFilterWhere(['like', 'twitterHandle', $this->twitterHandle])->andFilterWhere(['like', 'facebookHandle', $this->facebookHandle]); return $dataProvider; }
*/ ?> <div class="critics-reviews-search"> <?php $form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']); ?> <?php //echo $form->field($model, 'Id') ?> <?php echo $form->field($model, 'criticId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\CriticsUser::find()->All(), 'Id', 'name'))); ?> <?php echo $form->field($model, 'estId'); ?> <?php // echo $form->field($model, 'description') ?> <?php // echo $form->field($model, 'foodRate') ?>
public function getCritic() { return $this->hasOne(CriticsUser::className(), ['Id' => 'criticId']); }