客户回收
This commit is contained in:
@@ -101,7 +101,6 @@ class CustomerController
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 执行分页查询
|
||||
$query = Customer::where($where)
|
||||
->orderBy('id', 'desc');
|
||||
@@ -116,7 +115,12 @@ class CustomerController
|
||||
$query->whereIn('grade', $grade);
|
||||
|
||||
}
|
||||
// return Util::success($query->toSql().serialize($where),$follow);
|
||||
|
||||
$recycle = Util::getParam('recycle', '');
|
||||
if ($recycle == 'recycle') {
|
||||
$query->onlyTrashed();
|
||||
}
|
||||
|
||||
$data = $query->paginate($perPage, ['*'], 'page', $page);
|
||||
|
||||
foreach ($data->items() as &$value) {
|
||||
@@ -126,6 +130,27 @@ class CustomerController
|
||||
return Util::page($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户恢复
|
||||
* @param Request $request
|
||||
* @return \support\Response
|
||||
*/
|
||||
public function restore(Request $request)
|
||||
{
|
||||
$id = Util::getParam('id', '');
|
||||
if (Util::isEmpty($id)) {
|
||||
return Util::fail([], trans('id_empty'));
|
||||
}
|
||||
$where = ['id' => $id];
|
||||
$res = Customer::where($where)->restore();
|
||||
if($res){
|
||||
return Util::success($res, trans('success'));
|
||||
}else{
|
||||
return Util::fail([], trans('fail'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户详情
|
||||
* @param Request $request
|
||||
|
||||
Reference in New Issue
Block a user