Example #1
0
 public function actionDelete($id)
 {
     $id = (int) $id;
     if (empty($id)) {
         return $this->redirect('index');
     }
     $famil_bud = new FamilyBudget();
     $sql = $famil_bud->findOne($id)->delete();
     return $this->redirect('index');
 }
Example #2
0
 public function actionCreate()
 {
     $famil_bud = new FamilyBudget();
     if ($famil_bud->load(Yii::$app->request->post()) && $famil_bud->validate()) {
         //return print_r($_POST);
         $famil_bud['fam_bud_create'] = date("Y-m-d");
         $famil_bud->save();
         return $this->redirect('index');
     }
     $users = new Users();
     $categ = new Categories();
     $inco_exp = new IncoExpenso();
     $mony = new CoursesMoney();
     $users = $users->find()->all();
     $categ = $categ->find()->all();
     $inco_exp = $inco_exp->find()->all();
     $mony = $mony->find()->all();
     return $this->render('create', ['users' => $users, 'categ' => $categ, 'inco_exp' => $inco_exp, 'mony' => $mony, 'famil_bud' => $famil_bud]);
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFamilyBudgets()
 {
     return $this->hasMany(FamilyBudget::className(), ['user_id' => 'user_id']);
 }