/** * Creates a new PurchaseOrderDetail model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($purchase_order_id) { $username = Yii::$app->user->identity->username; $model = new PurchaseOrderDetail(); $model->purchase_order_id = $purchase_order_id; $this->purchase_order_id = $model->purchase_order_id; if (Yii::$app->request->isPost && ($model = PurchaseOrderDetail::create(Yii::$app->request->post()))) { return $this->redirect(['update', 'id' => $model->id]); } else { return $this->render('create', ['username' => $username, 'model' => $model]); } }