{"action":"created","issue":{"url":"https://api.github.com/repos/gazsp/baum/issues/5","labels_url":"https://api.github.com/repos/gazsp/baum/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/gazsp/baum/issues/5/comments","events_url":"https://api.github.com/repos/gazsp/baum/issues/5/events","html_url":"https://github.com/gazsp/baum/issues/5","id":127455271,"number":5,"title":"new item adding issue","user":{"login":"amin101","id":14128415,"avatar_url":"https://avatars.githubusercontent.com/u/14128415?v=3","gravatar_id":"","url":"https://api.github.com/users/amin101","html_url":"https://github.com/amin101","followers_url":"https://api.github.com/users/amin101/followers","following_url":"https://api.github.com/users/amin101/following{/other_user}","gists_url":"https://api.github.com/users/amin101/gists{/gist_id}","starred_url":"https://api.github.com/users/amin101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amin101/subscriptions","organizations_url":"https://api.github.com/users/amin101/orgs","repos_url":"https://api.github.com/users/amin101/repos","events_url":"https://api.github.com/users/amin101/events{/privacy}","received_events_url":"https://api.github.com/users/amin101/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-19T14:16:05Z","updated_at":"2016-01-20T11:55:08Z","closed_at":"2016-01-19T21:16:03Z","body":"if try to add a new tree to database using `buildTree()` method and the tree has `left` and `right` but not `id` , it will change new item's and its parent's `left` and `right` by itself.\r\ni think this job should be done only when there are no `left` and `right` attributes, because there are jquery plugins such as nestedSortable that do this job perfectly at client side ,so performing it at server side for second time will disarrange menu order <br/>\r\nexample:\r\ncomments  are values after saving in database using `buildTree` method \r\n       \r\n     $menu_cc = [\r\n            [ 'id' => 1, 'parent_id' => null, 'left' => 1, 'right' => 4//8, 'name' => 'r1' ],\r\n             [ 'id' => 2, 'parent_id' => 1, 'left' => 4 , 'right' => 5, 'name' => 'm2'] \r\n            [ 'id' => null, 'parent_id' => 1, 'left' => 2//6 , 'right' => 3//7, 'name' => 'm3'] \r\n          ];\r\n      "},"comment":{"url":"https://api.github.com/repos/gazsp/baum/issues/comments/173182717","html_url":"https://github.com/gazsp/baum/issues/5#issuecomment-173182717","issue_url":"https://api.github.com/repos/gazsp/baum/issues/5","id":173182717,"user":{"login":"amin101","id":14128415,"avatar_url":"https://avatars.githubusercontent.com/u/14128415?v=3","gravatar_id":"","url":"https://api.github.com/users/amin101","html_url":"https://github.com/amin101","followers_url":"https://api.github.com/users/amin101/followers","following_url":"https://api.github.com/users/amin101/following{/other_user}","gists_url":"https://api.github.com/users/amin101/gists{/gist_id}","starred_url":"https://api.github.com/users/amin101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amin101/subscriptions","organizations_url":"https://api.github.com/users/amin101/orgs","repos_url":"https://api.github.com/users/amin101/repos","events_url":"https://api.github.com/users/amin101/events{/privacy}","received_events_url":"https://api.github.com/users/amin101/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T11:55:08Z","updated_at":"2016-01-20T11:55:08Z","body":"Ok,lets say we have a menu containing submenus:\r\n\r\nroot\r\n-------sub1\r\n-------sub2\r\n\r\n\r\n    $menu_cc = [\r\n        [ 'id' => 1, 'parent_id' => null, 'name' => 'root' ],\r\n         [ 'id' => 2, 'parent_id' => 1, 'name' => 'sub1'] \r\n        [ 'id' => 3, 'parent_id' => 1, 'name' => 'sub2'] \r\n       ];\r\n\r\nif i try to add a new subitem between `sub1` and `sub2` : \r\n\r\n       $menu_cc = [\r\n         [ 'id' => 1, 'parent_id' => null, 'name' => 'root' ],\r\n         [ 'id' => 2, 'parent_id' => 1, 'name' => 'sub1'] ,\r\n         [ 'id' => 2, 'parent_id' => 1, 'name' => 'sub3'] ,//note this submenu should be between sub1 & sub2\r\n         [ 'id' => 3, 'parent_id' => 1, 'name' => 'sub2'] \r\n        ];\r\n\r\nthen update the tree using `buildTree()` , it doesnt care about order of submenus and add new sub3  as the last sub of tree."}}