modules/admin/controllers/SubAdminController.php
/**
     * Updates an existing SubAdmin 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 SubAdmin 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 SubAdmin 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->validate()) {
            $model->user_type = (string)User::USER_TYPE_SUB_ADMIN;
            $model->password_hash = \Yii::$app->security->generatePasswordHash($model->password);
            if ($model->save()) {
                Yii::$app->session->setFlash(Growl::TYPE_SUCCESS, "Sub admin updated successfully.");
            } else {
                Yii::$app->session->setFlash(Growl::TYPE_DANGER, "Error while updating sub admin.");
            }
            return $this->redirect(['index']);
        }
        return $this->render('update', [
            'model' => $model,
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> validate ( ) ) { $ model -> user_type = ( string ) User :: USER_TYPE_SUB_ADMIN ; $ model -> password_hash = \ Yii :: $ app -> security -> generatePasswordHash ( $ model -> password ) ; if ( $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_SUCCESS , " Sub admin updated successfully. " ) ; } else { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_DANGER , " Error while updating sub admin. " ) ; } return $ this -> redirect ( [ 'index' ] ) ; } return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; }
Updates an existing SubAdmin model.
Updates an existing SubAdmin model .