/**
  * {@inheritdoc}
  */
 public function format()
 {
     $attributes = $this->instance->getAttributes();
     $volumes = $this->instance->allVolumes();
     foreach ($volumes as $index => $volume) {
         $attributes["volumes"][$index] = $volume->volumeToArray();
     }
     return json_encode($attributes);
 }
Ejemplo n.º 2
0
 * Set the token api.
 */
\Axado\Shipping::$token = "your-token";
/**
 * Create a Axado Shipping.
 */
$shipping = new Axado\Shipping();
/**
 * Setting a sale order infos
 */
$shipping->setPostalCodeOrigin('04661100');
$shipping->setPostalCodeDestination('13301430');
$shipping->setAditionalPrice('12.6%');
$shipping->setTotalPrice('40');
$shipping->setAditionalDays('10');
dd($shipping->getAttributes());
/**
 * Add volumes to shipping
 */
$volume = new Stub();
$shipping->addVolume($volume);
/**
 * Getting all quotations
 */
var_dump($shipping->quotations());
/**
 * Get the costs and dealine to the first Quotation.
 */
var_dump($shipping->getCosts());
// in reais
var_dump($shipping->getDeadline());