示例#1
0
 /**
  * Returns a view that makes a form to update a category.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @see CategoriesController::postEdit() method saves the data
  * @param int $categoryId
  * @since [v1.0]
  * @return View
  */
 public function getEdit($categoryId = null)
 {
     // Check if the category exists
     if (is_null($category = Category::find($categoryId))) {
         // Redirect to the blogs management page
         return redirect()->to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
     }
     // Show the page
     //$category_options = array('' => 'Top Level') + Category::lists('name', 'id');
     $category_options = array('' => 'Top Level') + DB::table('categories')->where('id', '!=', $categoryId)->lists('name', 'id');
     $category_types = Helper::categoryTypeList();
     return View::make('categories/edit', compact('category'))->with('category_options', $category_options)->with('category_types', $category_types);
 }