client = new Client([ 'base_uri' => $default, 'timeout' => 30, 'connect_timeout' => 10, ]); } public function getPengajuanSk() { try { $response = $this->client->get('api/pengajuan-sk'); } catch (Throwable $th) { Log::error('Aktivitas Pelayanan Service : '.$th->getMessage()); return false; } $data = json_decode($response->getBody()->getContents(), true); return $data; } public function verifikasiPengajuan($id, $status, $catatan = null) { try { // Jika status dibatalkan dari frontend, kirim sebagai diajukan ke API $apiStatus = $status === 'dibatalkan' ? 'diajukan' : $status; $payload = [ 'status' => $apiStatus, ]; if ($catatan) { $payload['keterangan'] = $catatan; } $response = $this->client->post("api/pengajuan-sk/{$id}/verifikasi", [ 'json' => $payload, 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], ]); $statusCode = $response->getStatusCode(); $body = $response->getBody()->getContents(); } catch (Throwable $th) { Log::error('Aktivitas Pelayanan Service Verifikasi : '.$th->getMessage()); return false; } $data = json_decode($body, true); if (json_last_error() !== JSON_ERROR_NONE) { Log::error('JSON decode error: '.json_last_error_msg()); return false; } return $data; } }