Example #1
0
 /**
  * @return Collection|Product[]
  */
 private function products() : Collection
 {
     if ($this->products === null) {
         $this->products = Product::all();
     }
     return $this->products;
 }
 /**
  * Should be able to build and access a valid XML sitemap.
  *
  * @slowThreshold 10000
  */
 public function testSiteMap()
 {
     Artisan::call('sitemap:build');
     $siteMapContent = $this->getSiteMap();
     $xml = new DOMDocument();
     $xml->load($siteMapContent);
     $errors = libxml_get_errors();
     $this->assertEmpty($errors, print_r($errors, true));
     foreach (Product::all() as $product) {
         $this->assertContains($product->url(), $siteMapContent, 'Sitemap should contain all product URLs.');
     }
 }
Example #3
0
 /**
  * Display a listing of the resource.
  *
  * @throws \InvalidArgumentException
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return $this->buildView('index', ['offers' => $this->offer->orderBy('created_at', 'desc')->paginate(), 'products' => Product::all()]);
 }