/**
  * Handles moving the category up or down in the list of categories.
  *
  * @param mixed $slug
  * @param mixed $direction
  * @return {\Illuminate\Http\RedirectResponse|\Illuminate\Http\RedirectResponse}
  */
 public function reposition($slug, $direction)
 {
     $this->authorize('laraboard::category-manage');
     $category = Category::whereSlug($slug)->firstOrFail();
     //  move up
     if ($direction == 'up') {
         $category->moveLeft();
     } else {
         $category->moveRight();
     }
     return redirect()->back()->with('success', 'Category successfully moved.');
 }
 public function create($parent_slug = null)
 {
     /**
      * @todo Limit this list to the categories this user can manage
      */
     $categories = Category::get()->lists('name', 'id');
     $category = Category::whereSlug($parent_slug)->first();
     $this->authorize('laraboard::board-create', $category);
     $parent_id = null;
     if (!empty($category)) {
         $parent_id = $category->id;
     }
     return view('laraboard::board.create', compact('categories', 'parent_id'));
 }