示例#1
0
 public function actionLanding()
 {
     $packages = Package::find()->where(['enable' => 1])->limit(4)->orderBy('position')->all();
     $toppups = Topup::find()->where(['enable' => 1])->limit(4)->orderBy('position')->all();
     $this->layout = 'unify/front_page';
     $temp = new HybrizyCartForm();
     $session = Yii::$app->user->isGuest ? $temp->loadSession('Hybrizy') : $temp->loadFromTable();
     if ($session == false) {
         $cart = ['totalCount' => 0];
     } else {
         $cart = $session;
     }
     return $this->render('landing', ['packages' => $packages, 'toppups' => $toppups, 'cart' => $cart]);
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Topup::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, 'unitPrice' => $this->unitPrice, 'maxCallOut' => $this->maxCallOut, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at, 'update_by' => $this->update_by, 'created_by' => $this->created_by, 'position' => $this->position, 'enable' => $this->enable, 'price' => $this->price, 'limitBy' => $this->limitBy, 'quota' => $this->quota]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }