/** * Edit the category * @param string $sku The Slug Of The Category To Edit * @access public * @return View */ public function getEdit($id = null) { $collection = $this->collections->find($id); if (!$collection) { return Redirect::to('manage/collections'); } return View::make('ProductCatalog::collections.edit')->with('collection', $collection); }
/** * Edit the category * @param string $sku The Slug Of The Category To Edit * @access public * @return View */ public function getEdit($id = null) { $category = $this->categories->find($id); if (!$category) { return Redirect::to('manage/categories'); } // Determine if the category parent should be disabled or not $hasSubCategories = $category->hasChildren(); $categoryDropdown = $this->getCategoriesDropdownHTML(); // Setup the old data so it's easy to find $mainImage = Input::old('mainImage', false); if ($mainImage === false and $category->getMainImage()) { $mainImage = $category->getMainImage()->id; } // Setup the old data so it's easy to find $thumbnailImage = Input::old('thumbnailImage', false); if ($thumbnailImage === false and $category->getThumbnailImage()) { $thumbnailImage = $category->getThumbnailImage()->id; } // Get all collections that have products $collections = $this->collections->allWithProducts(); $collections_lists = [0 => 'Assign Collection'] + $collections->lists('name', 'id'); return View::make('ProductCatalog::categories.edit')->with('category', $category)->with('mainImageId', $mainImage)->with('collections', $collections)->with('collections_lists', $collections_lists)->with('thumbnailImageId', $thumbnailImage)->with('categoryDropdown', $categoryDropdown)->with('hasSubCategories', $hasSubCategories); }