Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.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 我想归档数据。如何在laravel 5.3中归档?_Php_Mysql_Laravel - Fatal编程技术网

Php 我想归档数据。如何在laravel 5.3中归档?

Php 我想归档数据。如何在laravel 5.3中归档?,php,mysql,laravel,Php,Mysql,Laravel,我需要在我的系统中存档数据。我使用Mysql和Laravel 5.3开发了这个系统。现在我创建了删除选中行的功能 EmployeeController.php public function deleteEmployeeEntries($id, Request $request) { $test = $this->Employee->delete($id); if($test) { $data['message'] = 'Record has

我需要在我的系统中存档数据。我使用Mysql和Laravel 5.3开发了这个系统。现在我创建了删除选中行的功能

EmployeeController.php

public function deleteEmployeeEntries($id, Request $request) {
    $test = $this->Employee->delete($id);
    if($test) {    
        $data['message'] = 'Record has been deleted successfully!';
    } else {
        $data['error'] = "Couldn't delete the user";
    }
    return $data;
}
EmployeeRepository.php

public function delete($id) {
    $data=$this->model->where('id','=',$id)->delete();
    return $data;
}

但我需要存档。我在数据库中维护状态列。如何将状态1更改为0

如果要更新某些表中的状态,需要使用
update()

save()


谢谢你的指导。@RuwanthaSameera如果这就是你想要的,那么你的问题是重复的
Model::where('id', 5)->update(['status' => 0]);
$model = Model::find(5);
$model->status = 0;
$model->save();