Beispiel #1
0
 /**
  * Create a new instance of BaseController class.
  *
  * @param $notificationRepo
  * @param $messageRepo
  * @return void
  */
 public function __construct(TypeInterface $typeRepo)
 {
     $types = $typeRepo->getList();
     $data = ['types' => $types];
     view()->share($data);
 }
Beispiel #2
0
 /**
  * Render view products.
  * GET /products/{$type}
  *
  * @return view
  */
 public function getProducts($type, ProductInterface $productRepo, TypeInterface $typeRepo)
 {
     $products = $productRepo->getProductByeType($type);
     $type = $typeRepo->getOne($type);
     $data = ['products' => $products, 'type' => $type];
     return view('public.products', $data);
 }
Beispiel #3
0
 /**
  * Render view for product editing.
  * GET /admin/edit-product/{id}
  *
  * @param  integer $id
  * @param  ProductInterface $productRepo
  * @param  TypeInterface $typeRepo
  * @return view
  */
 public function getEditProduct($id, ProductInterface $productRepo, TypeInterface $typeRepo)
 {
     $product = $productRepo->getOne($id);
     $types = $typeRepo->getList();
     $typeData = [];
     foreach ($types as $type) {
         $typeData[$type->id] = $type->name;
     }
     $data = ['bodyClass' => 'skin-3 no-skin', 'action' => 'edit', 'types' => $typeData, 'productData' => $product, 'product' => true, 'id' => $id];
     return view('admin.product.add-edit-product', $data);
 }