软删除

 

//文章管理(删除)
$(document).on('click','.del',function () {
// alert(123)
var id = $(this).parents("tr").attr('id');
//console.log(id)
var obj = $(this);
$.get(
"articledel",
{
id:id
},
function (data) {
console.log(data)
if(data.sum=="0"){
obj.parents('tr').remove();
}
}
);
});

 

//文章管理(删除)
public function articledel(Request $request){
$id = $request->get('id');
// dd($id);
$res = new Article();
$data = $res->articledel($id);
if($data){
return response()->json(['sum'=>0,'msg'=>'删除成功']);
}else{
return response()->json(['sum'=>1,'msg'=>'删除失败']);
}
}

 

//文章管理(删除)
public function articledel($id){
$yy = [
'bid'=>1
];
return $this->where('id',$id)->update($yy);
}

 

 

posted @ 2019-07-10 14:26  同学文  阅读(270)  评论(0编辑  收藏  举报