broker : GWM

This commit is contained in:
Gowtham M 2025-12-11 10:26:11 +05:30
parent 3a57d2adab
commit c7d68ad680

View File

@ -168,7 +168,7 @@ class PolicyController extends ResourceController
public function updatePolicy() public function updatePolicy()
{ {
try { try {
$data = $this->request->getPost(); $data = $this->request->getJSON(true);
if (!isset($data['id'])) { if (!isset($data['id'])) {
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'ID Required'], 200); return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'ID Required'], 200);
} }
@ -440,13 +440,14 @@ class PolicyController extends ResourceController
} }
$filePath = WRITEPATH . "uploads/policy/{$folder}/" . $fileRecord[$fileColumn]; $filePath = WRITEPATH . "uploads/policy/{$folder}/" . $fileRecord[$fileColumn];
$publicUrl = base_url("uploads/policy/{$folder}/" . $fileRecord[$fileColumn]);
if (!file_exists($filePath)) { if (!file_exists($filePath)) {
return $this->respond(['status' => 'failed','code' => 404,'data' => 'File missing on server'], 200); return $this->respond(['status' => 'failed','code' => 404,'data' => 'File missing on server'], 200);
} }
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $filePath ], 200); return $this->respond(['status' => 'success', 'code' => 200, 'data' => $publicUrl ], 200);
} catch (\Exception $e) { } catch (\Exception $e) {