public function init() { parent::init(); $this->notify_new_count = Notify::find()->where('status=1')->count(); $this->notify_count = Notify::find()->count(); $this->callback_new_count = Callback::find()->where('status=1')->count(); $this->callback_count = Callback::find()->count(); $this->orders_count = Orders::find()->count(); $this->orders_new_count = Orders::find()->where('statusID=2')->count(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Notify::find()->orderBy('(case when status=1 then 1 else 0 end) desc'); $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, 'productID' => $this->productID, 'date' => $this->date]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email]); return $dataProvider; }