url 点击蛋糕 php 更新 table 中一行的状态字段

update status field of a row in a table on url click in cake php

我在cakephp中创建了一个报价模块。在 index.ctp 视图中,我需要添加一个 link 来批准报价。最初我已将报价设置为待处理。因此,当用户访问 index.ctp 时,他将能够查看所有待处理和已批准的报价。我唯一的问题是单击批准 url

时无法将状态更新为已批准
public function update($id) {   
            $this->Quotation->id = $id;
            $this->request->is(array('post', 'put'));  
            $data = array(
            'Quotation' => array(
                    'Quot_id'          =>    $id,
                    'status'   =>    'Approved'
           )
    );
            $this->Quotation->save( $data, false, array('status'));
            return $this->redirect(array('action' => 'index'));
}
<?php 
echo $this->Form->postLink(__('Approve'), array('action' => 'update', $quotation['Quotation']['Quot_id']), array(), __('Are you sure you want to Approve # %s?', $quotation['Quotation']['Quot_id']));
?>

将 'id' 添加到 fieldList 数组:

$this->Quotation->save( $data, false, array('id','status'));