backend/controllers/LoginController.php
/**
     * Updates an existing Login 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 Login 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 Login 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);
        if ($model->load(Yii::$app->request->post())) {
            $model->foto = UploadedFile::getInstance($model, 'foto');
            if ($model->password == "") {
                $data = Login::findOne($id);
                $model->password = $data->password;
            }
            else
            {
                $model->password = md5($model->password);
            }
            $model->save();
            Yii::$app->session->setFlash('success', 'Disimpan');
            return $this->redirect(['view', 'id' => $model->id_login]);
        }
        return $this->render('update', [
            'model' => $model,
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ model -> foto = UploadedFile :: getInstance ( $ model , 'foto' ) ; if ( $ model -> password == " " ) { $ data = Login :: findOne ( $ id ) ; $ model -> password = $ data -> password ; } else { $ model -> password = md5 ( $ model -> password ) ; } $ model -> save ( ) ; Yii :: $ app -> session -> setFlash ( 'success' , 'Disimpan' ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> id_login ] ) ; } return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; }
Updates an existing Login model.
Updates an existing Login model .