/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Autocat::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(['id' => $this->id]); $query->andFilterWhere(['like', 'name_ru', $this->name_ru])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'name_az', $this->name_az])->andFilterWhere(['like', 'maxpas', $this->maxpas])->andFilterWhere(['like', 'photo', $this->photo]); return $dataProvider; }
public function actionAccardion() { $auto = Autocat::find()->joinWith('autos')->orderBy(['autocat.id' => SORT_ASC])->asArray()->all(); return $this->renderPartial('accardion', ['auto' => $auto]); }
use yii\widgets\ActiveForm; use common\models\Autocat; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model common\models\Auto */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="auto-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'idcat')->dropDownList(ArrayHelper::map(Autocat::find()->all(), 'id', 'name_az'), ['prompt' => ''])->label(false); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'photo')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'carnumber')->textInput(['maxlength' => true]); ?> <div class="form-group">