cart = $cart; $this->address = $address; $this->order = $order; $this->details = $details; $this->history = $history; } /** * Returns count of cart. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.cart.gadget', $count = 10) { if (User::hasRole('user')) { $this->cart->pushCriteria(new \Litepie\Laraecart\Repositories\Criteria\CartUserCriteria()); } $cart = $this->cart->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('cart::' . $view, compact('cart'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.address.gadget', $count = 10) { if (User::hasRole('user')) { $this->address->pushCriteria(new \Litepie\Laraecart\Repositories\Criteria\AddressUserCriteria()); } $address = $this->address->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('cart::' . $view, compact('address'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.order.gadget', $count = 10) { if (User::hasRole('user')) { $this->order->pushCriteria(new \Litepie\Laraecart\Repositories\Criteria\OrderUserCriteria()); } $order = $this->order->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('cart::' . $view, compact('order'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.details.gadget', $count = 10) { if (User::hasRole('user')) { $this->details->pushCriteria(new \Litepie\Laraecart\Repositories\Criteria\DetailsUserCriteria()); } $details = $this->details->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('cart::' . $view, compact('details'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.history.gadget', $count = 10) { if (User::hasRole('user')) { $this->history->pushCriteria(new \Litepie\Laraecart\Repositories\Criteria\HistoryUserCriteria()); } $history = $this->history->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('cart::' . $view, compact('history'))->render(); } }