我在cake php中创建了一个引用模块。在index.ctp视图中,我需要添加一个链接来批准报价。我最初将报价设置为待定。因此,当用户访问index.ctp时,他将能够查看所有待处理和批准的报价。我唯一的问题是,单击“批准网址”时,我无法将状态更新为已批准
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']));
?>
答案 0 :(得分:0)
将'id'添加到fieldList数组:
$this->Quotation->save( $data, false, array('id','status'));