/** * 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); }
/** * 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); }