Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * Finds the Notify model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Notify the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Notify::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }