public function actionKemasancreate() { $model = new Kemasan(); $this->layout = $this->CheckSession(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['warehouse/kemasanindex', 'id' => $model->Kemasan_ID]); } else { $id = $model->getLastIdKemasan(); $model->Kemasan_ID = $id + 1; return $this->render('kemasan/create', ['model' => $model]); } }