Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将更新后的数据保存在yii2中的数据库中?_Php_Yii2_Yii Extensions - Fatal编程技术网

Php 如何将更新后的数据保存在yii2中的数据库中?

Php 如何将更新后的数据保存在yii2中的数据库中?,php,yii2,yii-extensions,Php,Yii2,Yii Extensions,我已安装“使列可编辑” 工作正常,但更新的数据不存储在数据库中。如何将其存储在数据库中 index.php [ 'class' => 'kartik\grid\EditableColumn', 'editableOptions' => [ 'header' => 'status', 'inputType' => Editabl

我已安装“使列可编辑”

工作正常,但更新的数据不存储在数据库中。如何将其存储在数据库中

index.php

  [
                'class' => 'kartik\grid\EditableColumn',
                'editableOptions' => [
                    'header' => 'status',
                    'inputType' => Editable::INPUT_TEXT,
                    'type' => 'danger',
                    'placement' => 'right',
                    'options' => [
                        'pluginOptions' => ['min' => 0, 'max' => 5000]
                    ]
                ],
                'attribute' => 'status',
                'hAlign' => 'center',
                'label' => 'Status',
                'filterType' => GridView::FILTER_SELECT2,
                'filter' => [ 'Present' => 'Present', 'Absent' => 'Absent', 'Leave' => 'Leave',],
                'filterInputOptions' => ['placeholder' => 'search by status'],
                'filterWidgetOptions' => [
                    'pluginOptions' => ['allowClear' => true],
                ],
            ],
public function actionIndex()
    {
        $searchModel = new AttendanceSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        if(isset($_POST['hasEditable'])){
            $staffindex=$_POST['editableIndex'];
            $status = $_POST['Attendance'][$staffindex]['status'];
            $staffid=$_POST['editableKey'];
            //save attendence
            return true;
        }
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
控制器

  [
                'class' => 'kartik\grid\EditableColumn',
                'editableOptions' => [
                    'header' => 'status',
                    'inputType' => Editable::INPUT_TEXT,
                    'type' => 'danger',
                    'placement' => 'right',
                    'options' => [
                        'pluginOptions' => ['min' => 0, 'max' => 5000]
                    ]
                ],
                'attribute' => 'status',
                'hAlign' => 'center',
                'label' => 'Status',
                'filterType' => GridView::FILTER_SELECT2,
                'filter' => [ 'Present' => 'Present', 'Absent' => 'Absent', 'Leave' => 'Leave',],
                'filterInputOptions' => ['placeholder' => 'search by status'],
                'filterWidgetOptions' => [
                    'pluginOptions' => ['allowClear' => true],
                ],
            ],
public function actionIndex()
    {
        $searchModel = new AttendanceSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        if(isset($_POST['hasEditable'])){
            $staffindex=$_POST['editableIndex'];
            $status = $_POST['Attendance'][$staffindex]['status'];
            $staffid=$_POST['editableKey'];
            //save attendence
            return true;
        }
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

任何
update()
method?@Insane skull thanx其工作。任何
update()
method?@Insane skull thanx其工作。