/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Paylog::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, 'user_id' => $this->user_id, 'sum' => $this->sum, 'type' => $this->type, 'created_at' => $this->created_at]); return $dataProvider; }
public function getFullSum() { return (int) Paylog::find()->where(['user_id' => Yii::$app->user->identity->id])->andWhere(['status' => Paylog::STATUS_PAID])->sum('sum'); }