move up and move down function
Class CategoriesController extends AppController {
public function index(){
$categories = $this->Categories->find()->order(['lft'=>'ASC']);
$this->set(compact('categories'));
}
public function moveDown(){
$this->request->allowMethod([‘post’,‘put’]);
$category= $this->Categories->get($id);
if($this->Categories->moveDown($category)){
$this->Flash->success(‘category has been moved downn’);
}
return $this->redirect($this->referer([‘action’=>‘index’]));
}
public function moveUp(){
$this->request->allowMethod([‘post’,‘put’]);
$category= $this->Categories->get(2);
if($this->Categories->moveUp($category)){
$this->Flash->success(‘category has been moved up’);
}
return $this->redirect($this->referer([‘action’=>‘index’]));
}
}
information
i am unable to move up and move down. how to decide amough by which we have to move up and move down please clear doubt