コード例 #1
0
 public function update(OrderUpdateRequest $request, Order $order)
 {
     $productsTotalChanged = $request->input('products_total') != $order->products_total;
     $shippingTotalChanged = $request->input('shipping_total') != $order->shipping_total;
     if (!$productsTotalChanged and !$shippingTotalChanged) {
         Flash::warning(trans('order::revision.no_change'));
         return back();
     }
     DB::transaction(function () use($order, $request, $productsTotalChanged, $shippingTotalChanged) {
         $orderRevision = new OrderRevision(['products_total' => $productsTotalChanged ? $request->input('products_total') : null, 'shipping_total' => $shippingTotalChanged ? $request->input('shipping_total') : null]);
         $orderRevision->setPerformer($this->account());
         $orderRevision->setReactor($order->getBuyer());
         $order->revisions()->save($orderRevision);
         event(new OrderRevisionEvent($orderRevision));
     });
     Flash::success('订单修改已提交,等待买家同意');
     return back();
 }
コード例 #2
0
 protected function asUser(User $user = null)
 {
     return parent::asUser($user ?: ($this->order ? $this->order->getBuyer() : null));
 }
コード例 #3
0
ファイル: User.php プロジェクト: gez-studio/gez-mall
 public function isOrderBuyer(Order $order)
 {
     return $this->is($order->getBuyer());
 }