/** * @return Generator|Product[] */ public function iterateAll() : Generator { /** @var Product $product */ foreach ($this->productResource->with('images')->cursor() as $product) { if (!$product->relationLoaded('images')) { $product->load('images'); } (yield $product); } }
/** * @return View */ public function products() { return $this->webUi->view('sales::offer.products', ['products' => Product::with(Product::standardRelations())->has('offers')->orderBy('updated_at', 'desc')->paginate()]); }