Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Expenses::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, 'total' => $this->total, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     return $dataProvider;
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getExpenses()
 {
     return $this->hasMany(Expenses::className(), ['id' => 'expenses_id'])->viaTable('{{%entp_expenses}}', ['entrepreneur_id' => 'id']);
 }
 protected function findExpenses($expenses_id)
 {
     if (($model = Expenses::findOne(['id' => $expenses_id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getExpenses()
 {
     return $this->hasOne(Expenses::className(), ['id' => 'expenses_id']);
 }