controllers/CargaController.php
/**
     * Creates a new Carga model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Carga model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Carga model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Carga();
        if ($model->load(Yii::$app->request->post())) {
            $date = date('Y-m-d');
            $model->FECHA_REGISTRO = $date;
            $model->ESTATUS_CARGA = 1;
            $modelBuque = Buque::findOne(['ID'=>$model->BUQUE_ID]);
            $model->DESCRIPCION = $modelBuque->NOMBRE.' - '.$model->FECHA_ATRAQUE;
            $model->save();
            return $this->redirect(['view', 'id' => $model->ID]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
public function actionCreate ( ) { $ model = new Carga ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ date = date ( 'Y-m-d' ) ; $ model -> FECHA_REGISTRO = $ date ; $ model -> ESTATUS_CARGA = 1 ; $ modelBuque = Buque :: findOne ( [ 'ID' => $ model -> BUQUE_ID ] ) ; $ model -> DESCRIPCION = $ modelBuque -> NOMBRE . ' - ' . $ model -> FECHA_ATRAQUE ; $ model -> save ( ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> ID ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } }
Creates a new Carga model.
Creates a new Carga model .
//$model->FECHA_REGISTRO = 'curdate()'; //var_dump($date);die; //var_dump($model->FECHA_REGISTRO);die;