/** * Creates a new OrdersTransport model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Assign(); $confix = new \app\models\Config_system(); $id = $confix->autoId_order("assign", "assign_id", 5); $newId = substr(date("Y"), -2) . "-" . $id; return $this->render('create', ['model' => $model, 'assign_id' => $newId]); }
/** * Creates a new OrdersTransport model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new OrdersTransportAffiliated(); $config = new \app\models\Config_system(); $id = $config->autoId_order("orders_transport_affiliated", "order_id", 5); $newId = substr(date("Y"), -2) . "T-" . $id; if ($model->load(Yii::$app->request->post())) { // Yii::$app->response->format = Response::FORMAT_JSON; if (Yii::$app->request->post('orders-transport-affiliated', null)) { $model->scenario = 'orders-transport-affiliated'; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post())) { $model->create_date = date("Y-m-d H:i:s"); $model->save(); return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model, 'order_id' => $newId]); } }