コード例 #1
0
ファイル: Bill.php プロジェクト: artemsk/veer-core
 public function add($params, $template = null)
 {
     $order = \Veer\Models\Order::find(array_get($params, 'orders_id'));
     $status = \Veer\Models\OrderStatus::find(array_get($params, 'status_id'));
     $payment = $payment_method = array_get($params, 'payment_method');
     $sendEmail = array_pull($params, 'sendTo', null);
     if (empty($payment)) {
         $payment = \Veer\Models\OrderPayment::find(array_get($params, 'payment_method_id'));
         $payment_method = isset($payment->name) ? $payment->name : $payment_method;
     }
     $content = '';
     if (!empty($template)) {
         /* leave 'view' instead of 'viewx' because we always need (rendered) html representation of the bill */
         $content = view("components.bills." . $template, ["order" => $order, "status" => $status, "payment" => $payment, "price" => array_get($params, 'price')])->render();
     }
     $b = new \Veer\Models\OrderBill();
     $b->fill($params);
     $b->users_id = isset($order->users_id) ? $order->users_id : 0;
     $b->payment_method = $payment_method;
     $b->content = $content;
     if (!empty($sendEmail)) {
         $b->sent = true;
     }
     $b->save();
     if (!empty($sendEmail) && is_object($order)) {
         $this->sendEmailBillCreate($b, $order);
     }
     return $this;
 }
コード例 #2
0
ファイル: Order.php プロジェクト: artemsk/veer-core
 /**
  * show One order
  */
 public function getOrderAdvanced($order)
 {
     if ($order == "new") {
         return new \stdClass();
     }
     $items = \Veer\Models\Order::find($order);
     if (is_object($items)) {
         $this->loadOrderRelations($items);
         $this->loadSiteTitle($items);
         if (is_object($items->products)) {
             $items->products = $this->regroupOrderProducts($items->products);
         }
         if (is_object($items->orderContent)) {
             $items->orderContent = $this->orderContentParse($items->orderContent, $items->products);
         }
     }
     if (empty(app('veer')->loadedComponents['billsTypes'])) {
         $this->getExistingBillTemplates();
     }
     return $items;
 }
コード例 #3
0
ファイル: DeleteTrait.php プロジェクト: artemsk/veer-core
 protected function deleteOrder($id)
 {
     $order = \Veer\Models\Order::find($id);
     if (is_object($order)) {
         \Veer\Models\OrderHistory::where('orders_id', '=', $id)->delete();
         $order->orderContent()->delete();
         $order->bills()->delete();
         $order->secrets()->delete();
         // communications skip
         $order->delete();
         return true;
     }
     return false;
 }
コード例 #4
0
ファイル: Order.php プロジェクト: artemsk/veer-core
 public function getOrder($id)
 {
     $this->id = $id;
     $this->order = \Veer\Models\Order::find($id);
     return $this;
 }