changes in route method

This commit is contained in:
sayliraut
2025-03-26 16:53:02 +05:30
parent c37eec7b19
commit befe84d338
6 changed files with 90 additions and 77 deletions

View File

@@ -11,6 +11,8 @@ use Illuminate\Http\Request;
use Exception;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
class CustomerController extends Controller
@@ -135,14 +137,18 @@ class CustomerController extends Controller
}
public function deleteCustomers($customerId)
public function deleteCustomers(Request $request)
{
try {
if (!$customerId) {
return jsonResponseWithErrorMessage('Customer ID is required', 400);
}
$validator = Validator::make($request->all(), [
'customer_id' => 'required|string',
]);
if ($validator->fails()) {
return jsonResponseWithErrorMessage($validator->errors()->first(), 400);
}
$customerId = $request->input('customer_id');
$response = $this->adminService->deleteCustomer(['customerId' => $customerId]);