Example #1
0
 /**
  * Order the specified resource in storage.
  *
  * @param int $id
  *
  * @return Response
  */
 public function order(Category $category)
 {
     if ($left_id = Request::get('leftId')) {
         $cat_left = Category::findOrFail($left_id);
         $category->moveToRightOf($cat_left);
     } elseif ($right_id = Request::get('rightId')) {
         $cat_right = Category::findOrFail($right_id);
         $category->moveToLeftOf($cat_right);
     } elseif ($parent_id = Request::get('parentId')) {
         $cat_parent = Category::findOrFail($parent_id);
         $category->makeChildOf($cat_parent);
     }
 }