/** * @param Request $request * * @return View|JsonResponse */ public function index(Request $request) { if ($request->isJson()) { return new JsonResponse(array_reverse($this->telegram->getUpdates())); } return $this->webUi->view('staff.telegram.index'); }
/** * Display PHP info output. * * @return string */ public function getPhpInfo() { ob_start(); phpinfo(); $info = ob_get_contents(); ob_get_clean(); return $this->webUi->view('staff.dashboard.info', compact('info')); }
/** * Display the "Christmas Cards" landing page. * * @return \Illuminate\Contracts\View\View */ public function christmasCardsAction() { return $this->webUi->view('customer.landing.christmas-cards', ['products' => $this->tagResource->where('name', '=', 'Christmas')->with(['products' => function ($query) { /* @var Product $query */ $query->inStock(); $query->with(['images', 'options', 'options.images', 'options.stockItems']); }])->first()->products]); }
/** * @param int $offerId * @param string $slug * * @throws ModelNotFoundException * * @return View|RedirectResponse */ public function view(int $offerId, string $slug) { /** @var Offer $offer */ $offer = Offer::findOrFail($offerId); if ($offer->slug() !== $slug) { return $this->webUi->redirect('offer.show', [$offerId, $offer->slug()]); } $products = Product::whereHas('offers', function ($query) use($offer) { /* @var Builder $query */ $query->where('id', '=', $offer->id); })->with(Product::standardRelations())->paginate(); return $this->webUi->view('sales::offer.view', compact('offer', 'products')); }
/** * @param int $id * @param string $slug * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * * @return View|RedirectResponse */ public function viewCategory(int $id, string $slug) { /** @var Category $category */ $category = $this->category->findOrFail(Category::privateId($id)); if ($category->slug() !== $slug) { return $this->webUi->redirect('categories.view', [$category->id, $category->slug()]); } $tree = $category->getDescendantsAndSelf()->load(['products' => function ($query) { /* @var Product $query */ $query->with(Product::standardRelations()); }]); return $this->webUi->view('customer.category.view', compact('category', 'tree')); }
/** * @param $name * @param array $bindData * * @return View */ private function buildView($name, array $bindData = []) : View { return $this->webUi->view("catalogue::staff.products.{$name}", $bindData); }
/** * Display a listing of the resource. * * @throws \InvalidArgumentException * * @return \Illuminate\Http\Response */ public function index() { return $this->webUi->view('catalogue::staff.categories.index', ['categories' => $this->category->roots()->with(['products', 'children'])->orderBy('depth', 'asc')->orderBy('created_at', 'desc')->paginate()]); }
/** * @param SearchRequest $request * * @return \Illuminate\Contracts\View\View */ public function searchAction(SearchRequest $request) { return $this->webUi->view('customer.product.search', ['query' => $request->searchQuery(), 'products' => $this->productResource->search($request->searchQuery())->paginate(self::PAGE_SIZE)]); }
/** * @return \Illuminate\Contracts\View\View */ public function choosePaymentAction() { return $this->webUi->view('customer.checkout.choose-payment', ['basket' => $this->checkoutAssistant->basket(), 'progress' => 50, 'stripeNonce' => random_int(0, PHP_INT_MAX)]); }
/** * @param int $orderId * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException * * @return string */ public function viewAction(int $orderId) { /** @var Order $order */ $order = $this->orderResource->with(['orderItems.basketItem.productOption.product', 'address'])->findOrFail($this->optimus->decode($orderId)); return $this->webUi->view('customer.orders.view', compact('order')); }
/** * @param $name * @param array $bindData * * @return View */ private function buildView($name, array $bindData = []) : View { return $this->webUi->view("sales::staff.orders.{$name}", $bindData); }
/** * @return \Illuminate\Contracts\View\View */ public function index() { $tags = $this->tagRepository->loadAll(); $newTag = new Tag(); return $this->webUi->view('catalogue::staff.tags.index', compact('tags', 'newTag')); }
/** * @throws \InvalidArgumentException * * @return \Illuminate\Contracts\View\View */ public function index() { $images = $this->imageRepository->loadLatest(); return $this->webUi->view('staff.images.index', compact('images')); }
/** * View the shopping basket. * * @return \Illuminate\Contracts\View\View */ public function viewBasketAction() { return $this->webUi->view('customer.basket.view'); }