/** * Creates a new Supplier model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Supplier(); if ($model->load(Yii::$app->request->post())) { $model->loadDefaultValues(); $model->save(); if ($model->save()) { $ensup = new EntpSupplier(); $ensup->supplier_id = $this->id; $ensup->entrepreneur_id = Yii::$app->user->id; $ensup->link('supplier', $model); } Yii::$app->session->setFlash('success', 'ok'); $searchModel = new EntpSupplierSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); //return $this->redirect(['view', 'id' => $model->id, 'profile_user_id' => $model->profile_user_id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Lists all EntpSupplier models. * @return mixed */ public function actionIndex() { $searchModel = new EntpSupplierSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }