public function search($params) { $query = Cuisine::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->setSort(['defaultOrder' => ['Id' => SORT_ASC, 'name' => SORT_ASC]]); $query->andFilterWhere([cuisine::tableName() . '.status' => '0']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'createdOn' => $this->createdOn, 'status' => $this->status, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'desc', $this->desc])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'searchAlias', $this->searchAlias]); return $dataProvider; }
<?php echo $form->field($model, 'pricefortwo')->dropDownList(ArrayHelper::merge(['' => 'Select'], \common\models\Restaurant::priceForTwo())); ?> <?php echo $form->field($modelBrandsCityField, 'pricefortwo')->checkbox(['label' => 'Lock']); ?> <?php /*/?><?= $form->field($model, 'cuisine')->dropDownList(ArrayHelper::merge([],ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name')),['multiple'=>'multiple','size'=>7,'title'=>'Select Cuisines']) ?> <?php //*/ ?> <?php echo $form->field($model, 'cuisine')->widget(Multiselect::className(), ['data' => ArrayHelper::merge([], ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), 'options' => ['multiple' => 'multiple', 'size' => 7, 'title' => 'Select Cuisines']]); ?> <?php // $form->field($model, 'cusinies')->textInput(['maxlength' => 225]) ?> <?php echo $form->field($modelBrandsCityField, 'cusinies')->checkbox(['label' => 'Lock']); ?> <?php echo $form->field($model, 'specilities')->textInput(['maxlength' => 225]); ?> <?php
/** * Finds the Cuisine model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Cuisine the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Cuisine::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getCuisine() { return $this->hasOne(Cuisine::className(), ['Id' => 'cuisineId']); }
/** * @return \yii\db\ActiveQuery */ public function getCuisines() { if (isset($this->_cuisines)) { return $this->_cuisines; } else { return $this->hasMany(Cuisine::className(), ['Id' => 'cuisineId'])->via('resMaps'); } /*/ $data = []; foreach($this->resMaps as $model){ if($model->cuisineId){ $data[]=$model->cuisineId; } } return $data; //*/ }
public function getPrimarycuisine() { if ($this->cusinies) { $cuisines = explode(',', $this->cusinies); if (!is_array($cuisines)) { $cuisines[] = $cuisines; } $res = Cuisine::find()->where('Id IN (:status)', [':status' => $cuisines])->all(); return $res[0]->name; } }
?> <?php //<?= $form->field($model, 'email')->textInput(['maxlength' => 100]) ?> <?php //<?= $form->field($model, 'guid')->textInput(['maxlength' => 512]) ?> <?php //<?= $form->field($model, 'old_guid')->textInput(['maxlength' => 512]) ?> <?php echo $form->field($model, 'cuisines')->dropDownList(ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[cuisineId][]']); ?> <?php echo $form->field($model, 'types')->dropDownList(ArrayHelper::map(\common\models\Types::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[typesId][]']); ?> <?php echo $form->field($model, 'feature')->dropDownList(ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[featureId][]']); ?> <?php echo $form->field($model, 'payment')->dropDownList(ArrayHelper::map(\common\models\Payments::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[paymentId][]']); ?> <div class="form-group">