/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Direction(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Direction'])) { $model->attributes = $_POST['Direction']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionCreateDirection() { $Directory = new Direction(); $Directory->date = $_POST['date']; $Directory->comment = $_POST['comment']; $Directory->cost = $_POST['cost']; $Directory->client = $_POST['client_name']; $Directory->Shipping = $_POST['route_name']; $Directory->carrier = $_POST['carrier_name']; $Directory->client_id = $_POST['client_id']; $Directory->carrier_id = $_POST['carrier_id']; $Directory->shipping_id = $_POST['route_id']; $Directory->manager_id = Yii::app()->user->id; $Directory->save(); if ($Directory->save()) { $model = new UserReports(); $model->user_id = (int) Yii::app()->user->id; $model->client_id = $_POST['client_id']; $model->action = 3; $model->comment = $_POST['comment']; $model->date = $_POST['date']; $model->save(); } $this->redirect(array('view', 'id' => $Directory->id)); }