Exemple #1
0
 /**
  * totalOrder
  * It is able to return the order total, as items number and price total
  * @param  [object] $items is the order details, which contains the purchase information
  * @return [array]
  */
 public static function totalOrder($items)
 {
     $data = ['qty' => 0, 'total' => 0];
     $items->each(function ($item, $key) use(&$data) {
         $data['qty'] += $item->quantity;
         $data['total'] += $item->price;
     });
     return $data;
 }