后台顾客管理
This commit is contained in:
parent
fdde2c56d7
commit
160b0bd3fe
|
|
@ -66,19 +66,17 @@ class CustomerController extends Controller
|
||||||
return json_success('创建成功!', $customer);
|
return json_success('创建成功!', $customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(Request $request)
|
public function destroy(Request $request, int $customerId)
|
||||||
{
|
{
|
||||||
$customerId = $request->id ?? 0;
|
|
||||||
CustomerRepo::delete($customerId);
|
CustomerRepo::delete($customerId);
|
||||||
|
|
||||||
return ['success' => true];
|
return json_success('删除成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function restore(Request $request)
|
public function restore(Request $request, int $customerId)
|
||||||
{
|
{
|
||||||
$customerId = $request->id ?? 0;
|
CustomerRepo::restore($customerId);
|
||||||
Customer::withTrashed()->find($customerId)->restore();
|
|
||||||
|
|
||||||
return ['success' => true];
|
return json_success('恢复成功!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@ class CustomerGroupRepo
|
||||||
*/
|
*/
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
{
|
{
|
||||||
$id = CustomerGroup::query()->insertGetId($data);
|
return CustomerGroup::query()->create($data);
|
||||||
return self::find($id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -91,5 +91,10 @@ class CustomerRepo
|
||||||
|
|
||||||
return $builder->paginate(20)->withQueryString();
|
return $builder->paginate(20)->withQueryString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function restore($id)
|
||||||
|
{
|
||||||
|
Customer::withTrashed()->find($id)->restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue