/** * Creates a new Sales model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $sales = new Sales(); if ($sales->load(Yii::$app->request->post())) { $sales->loadDefaultValues(); $sales->save(); if ($sales->save()) { $entp = new EntpSales(); $entp->sales_id = $this->id; $entp->entrepreneur_id = Yii::$app->user->id; $entp->link('sales', $sales); } Yii::$app->session->setFlash('success', 'New Product Add'); $searchModel = new EntpSalesSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } else { return $this->render('create', ['model' => $sales]); } }
/** * Lists all EntpSales models. * @return mixed */ public function actionIndex() { $searchModel = new EntpSalesSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }