我有一些类似capabilities之类的表,其中有group_id
存储在capability_groups中。另一个表capability_level和一个数据透视表存储了capabilities_id.capability_level_id
。
我想使用作为父级和子级的组获取数组数据,并附带功能级别数据。
Array
(
[0] => Array
(
[id] => 1
[title] => Relationships
[image] => 1562843787.jpg
[created_at] => 2019-07-11 11:16:28
[updated_at] => 2019-07-11 11:16:28
[childs] => Array
(
[0] => Array
(
[id] => 7
[title] => Display Resilience and Courage
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:04:39
[updated_at] => 2019-07-11 12:04:39
)
[1] => Array
(
[id] => 8
[title] => Business enablers
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:27:30
[updated_at] => 2019-07-11 12:27:30
)
[2] => Array
(
[id] => 9
[title] => asdasd
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:28:04
[updated_at] => 2019-07-11 12:28:04
)
Array
(
[0] => Array
(
[id] => 1
[title] => Relationships
[image] => 1562843787.jpg
[created_at] => 2019-07-11 11:16:28
[updated_at] => 2019-07-11 11:16:28
[childs] => Array
(
[0] => Array
(
[id] => 7
[title] => Display Resilience and Courage
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:04:39
[updated_at] => 2019-07-11 12:04:39
)
[1] => Array
(
[id] => 8
[title] => Business enablers
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:27:30
[updated_at] => 2019-07-11 12:27:30
)
[2] => Array
(
[id] => 9
[title] => asdasd
[group_id] => 1
[level_id] =>
[level_description] =>
[created_at] => 2019-07-11 12:28:04
[updated_at] => 2019-07-11 12:28:04
)
我越来越想要获得功能级别标题(使用ID)到数组。