示例#1
0
 public function recommendedProducts()
 {
     $productGallery = $this->productGalleries()->first();
     if ($productGallery == null) {
         $productGallery = new ProductGallery();
     }
     return $productGallery->productGalleryItems();
 }
 public function mainProductGallerySave(Request $request)
 {
     $productGallery = ProductGallery::whereNull('product_category_id')->whereNull('product_line_id')->whereNull('product_id')->first();
     $productGallery->productGalleryItems()->delete();
     if ($request->input('product_id') != null) {
         foreach ($request->input('product_id') as $productId) {
             $productGallery->productGalleryItems()->save(new ProductGalleryItem(['product_id' => $productId]));
         }
     }
     return redirect('/admin/mainProductGallery/');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     ProductGallery::create();
 }