public function index() { $rajaOngkir = new RajaOngkir("d17256b1d6cb5da9539a286c4e0d6183"); $data['products'] = Cart::content(); $data['total'] = Cart::total(); $data['province'] = $rajaOngkir->getProvince()->body->rajaongkir->results; $data['city'] = $rajaOngkir->getCity()->body->rajaongkir->results; return $this->view('checkout.index', $data); }
/** * Constructor * @param string $api_key API Key Anda sebagaimana yang tercantum di akun panel RajaOngkir * @param array $additional_headers Header tambahan seperti android-key, ios-key, dll */ public function __construct($api_key, $additional_headers = array()) { RajaOngkir::$api_key = $api_key; \Unirest::defaultHeader("Content-Type", "application/x-www-form-urlencoded"); \Unirest::defaultHeader("key", RajaOngkir::$api_key); foreach ($additional_headers as $key => $value) { \Unirest::defaultHeader($key, $value); } }