public function index()
 {
     $shop = $this->account();
     $orders = $shop->orders()->take(10)->get();
     /*Product Count*/
     $data['productCount'] = $shop->products()->count();
     $data['activeProductCount'] = $shop->products()->active()->count();
     /*Order Count*/
     $data['cancelledOrderCount'] = $shop->orders()->hasStatus('cancelled')->count();
     $data['pendingOrderCount'] = $shop->orders()->hasStatus('pending')->count();
     $data['processingOrderCount'] = $shop->orders()->hasStatus('processing')->count();
     $data['onrouteOrderCount'] = $shop->orders()->hasStatus('onroute')->count();
     $data['completeOrderCount'] = $shop->orders()->hasStatus('complete')->count();
     $data['needUserActionOrderCount'] = OrderCancellation::active()->by($shop)->count();
     $data['needShopActionOrderCount'] = OrderCancellation::active()->for($shop)->count();
     return view('shop::__shop.home', compact('orders') + $data);
 }
 public function decide(User $user, OrderCancellation $orderCancellation)
 {
     return $orderCancellation->isActive() and $orderCancellation->getReactor()->is(account());
 }
Exemple #3
0
 public function decideCancellation(OrderCancellation $orderCancellation, $approved)
 {
     $orderCancellation->setApproved((bool) $approved);
     list($updated, $orderCancellation) = $this->getOrderCancellationRepository()->save($orderCancellation);
     if ($updated) {
         event(new OrderCancellationEvent($orderCancellation));
     }
     return $orderCancellation;
 }