backend/controllers/TransaksiController.php
/**
     * Updates an existing Transaksi model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Updates an existing Transaksi model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Updates an existing Transaksi model . If update is successful the browser will be redirected to the ' view ' page . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $data_mobil = ArrayHelper::map(
            Mobil::find()->all(),
            'id_mobil','merk'
        );
        $customer=new Customer();
        $data_customer = ArrayHelper::map(
            Customer::find()->all(),
            'id_customer',function($customer){
                return $customer['nama'];
            }
        );
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', 'Disimpan');
            return $this->redirect(['view', 'id' => $model->id_transaksi]);
        }
        return $this->render('update', [
            'model' => $model,
            'data_mobil' => $data_mobil,
            'data_customer' => $data_customer
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ data_mobil = ArrayHelper :: map ( Mobil :: find ( ) -> all ( ) , 'id_mobil' , 'merk' ) ; $ customer = new Customer ( ) ; $ data_customer = ArrayHelper :: map ( Customer :: find ( ) -> all ( ) , 'id_customer' , function ( $ customer ) { return $ customer [ 'nama' ] ; } ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'success' , 'Disimpan' ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> id_transaksi ] ) ; } return $ this -> render ( 'update' , [ 'model' => $ model , 'data_mobil' => $ data_mobil , 'data_customer' => $ data_customer ] ) ; }
Updates an existing Transaksi model.
Updates an existing Transaksi model .