Closed bharatows closed 9 months ago
There is an issue for sequence sibling sorting order: Please check screenshot for more information.
$categories = json_decode('[{"id":1,"children":[{"id":2,"children":[{"id":3}]},{"id":8},{"id":9}]},{"id":4,"children":[{"id":7},{"id":5,"children":[{"id":6}]}]}]',true); Node::rebuildSubtree(null, $categories);
CREATE TABLE `categories` ( `id` bigint UNSIGNED NOT NULL, `title` text COLLATE utf8mb4_unicode_ci, `_lft` int UNSIGNED NOT NULL DEFAULT '0', `_rgt` int UNSIGNED NOT NULL DEFAULT '0', `parent_id` int UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO `categories` (`id`, `title`, `_lft`, `_rgt`, `parent_id`) VALUES (1, 'Category 1', 1, NULL, 1, 10, NULL), (2, 'Category 1.1', 1, NULL, 2, 5, 1), (3, 'Category 1.1.1', 1, NULL, 3, 4, 2), (4, 'Category 2', 1, NULL, 11, 18, NULL), (5, 'Category 2.2', 1, NULL, 14, 17, 4), (6, 'Category 2.2.2', 1, 1, 15, 16, 5), (7, 'Category 2.2.2.2', 1, NULL, 12, 13, 4), (8, 'Category 1.2', 1, NULL, 6, 7, 1), (9, 'Category 1.3', 1, NULL, 8, 9, 1);
Issue with display fetch order I have used Node::get()->toTree(); rather than Node::defaultOrder()->get()->toTree(); it is working fine. thanks
Node::get()->toTree();
Node::defaultOrder()->get()->toTree();
There is an issue for sequence sibling sorting order: Please check screenshot for more information.