public function actionIndex($mid = '', $f = 0) { $user = User::findIdentity(Yii::$app->user->id); $regFrm = new RegisterForm(); $rstFrm = new RestorePswForm(); $spOffs = new SpecialOffer(); $spOffs = $spOffs->getAllSpecialOffers(); if ($f) { $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN_CAPTCHA]); } else { $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN]); } $city = City::find()->all(); $address = new Address(); $distr = $address->getDistrict(); $category = Category::find()->all(); $brand = Brand::find()->all(); $msg = ''; switch ($mid) { case 1: $msg = Common::M_EMAIL_SEND; break; case 2: $msg = Common::M_PSW_EMAIL_SEND; break; case 3: $msg = Common::M_PSW_RESTORE_SUCCESS; break; } return $this->render('index', ['msg' => $msg, 'user' => $user, 'spOffs' => $spOffs, 'regFrm' => $regFrm, 'logFrm' => $logFrm, 'rstFrm' => $rstFrm, 'city' => $city, 'distr' => $distr, 'category' => $category, 'brand' => $brand]); }
public function getBrands() { $ret = []; foreach (Brand::find()->all() as $o) { $ret[$o->key] = $o->id; } return (object) $ret; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Brand::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 15]]); $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, 'show_type_name' => $this->show_type_name, 'is_show' => $this->is_show, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'is_deleted' => 0]); $query->andFilterWhere(['like', 'cn_name', $this->cn_name])->andFilterWhere(['like', 'en_name', $this->en_name])->andFilterWhere(['like', 'py_name', $this->py_name])->andFilterWhere(['like', 'initial', $this->initial])->andFilterWhere(['like', 'logo', $this->logo])->andFilterWhere(['like', 'sn', $this->sn]); return $dataProvider; }
public function sort(Request $request) { $brand = Brand::find($request->id); $brand->sort_order = $request->sort_order; $brand->save(); }
/** * Lists all Brand models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Brand::find(), 'pagination' => ['pageSize' => 200]]); return $this->render('index', ['dataProvider' => $dataProvider]); }