/** * Show the application welcome screen to the user. * * @return Response */ public function index() { $categoriesObj = Category::all(); $categoriesArr = Category::getCategoriesArr($categoriesObj); $parentChildArr = CategoryParentAndChildren::getHierarchy(); return view('welcome', compact('categoriesObj', 'parentChildArr', 'categoriesArr')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Member $memberObj) { $memberSocialIdArr = Member::getMemberSocialIdArr($memberObj->id); $parentChildArr = CategoryParentAndChildren::getHierarchy(); $categoriesArr = Category::getCategoriesArr(); $memberCategoryIdArr = Member::getMemberCategoryIdArr($memberObj->id); return view('members.edit', compact('memberObj', 'memberSocialIdArr', 'parentChildArr', 'memberCategoryIdArr', 'categoriesArr')); }
/** * Update the specified resource in storage. * * @param int Categories $category * @return Response */ public function update(Category $category) { $inputArr = Input::all(); $parentIdArr = $inputArr['parent_id']; $deleteParentIdArr = isset($inputArr['delete_parent_id']) ? $inputArr['delete_parent_id'] : array(); $id = $inputArr['category_id']; $inputArr = array_except($inputArr, array('_method', 'parent_id', 'category_id', 'delete_parent_id')); $category->update($inputArr); CategoryParentAndChildren::saveParentChild($parentIdArr, $id, $deleteParentIdArr); return Redirect::route('categories.edit', [$category->slug])->with('message', 'Category updated.'); }