/** * Creates a new Caixa modelCaixa. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { // $caixa = new Caixa(); $caixas = Caixa::find()->all(); $modelCaixa = new Caixa(); $modelCaixa->dataabertura = date('Y-m-d'); if ($modelCaixa->load(Yii::$app->request->post()) && $modelCaixa->save()) { return $this->redirect(['view', 'id' => $modelCaixa->idcaixa]); } else { $modelCaixa->valorapurado = 0; $modelCaixa->valoremcaixa = 0; $modelCaixa->valorlucro = 0; return $this->render('create', ['modelCaixa' => $modelCaixa]); } // $caixa = Caixa::find()->where(['user_id'=>Yii::$app->user->getId()])->one(); }
/** * Creates a new Caixa model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Caixa(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->idcaixa]); } else { return $this->render('create', ['model' => $model]); } }