1 | <?php |
||
38 | class Permission extends EntrustPermission |
||
39 | { |
||
40 | use TreeTrait; |
||
41 | |||
42 | protected $hidden = ['created_at', 'updated_at']; |
||
43 | |||
44 | protected $guarded = ['created_at', 'updated_at']; |
||
45 | |||
46 | protected $treeNodeParentIdName = 'pid'; |
||
47 | |||
48 | private $allRoutes = null; |
||
49 | |||
50 | private $validList = null; |
||
|
|||
51 | |||
52 | private $permList = null; |
||
53 | |||
54 | private $menuList = null; |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @return \Illuminate\Support\Collection |
||
59 | */ |
||
60 | public function getMenuTreeList() |
||
66 | |||
67 | private function getAll() |
||
79 | |||
80 | /** |
||
81 | * Tree Trait 获取所有节点 |
||
82 | * |
||
83 | * @return mixed|null |
||
84 | */ |
||
85 | protected function getTreeAllNodes() |
||
89 | |||
90 | /** |
||
91 | * 获取有效的路由列表 |
||
92 | * |
||
93 | * @return \Illuminate\Support\Collection |
||
94 | */ |
||
95 | /*public function getValidRouteList() |
||
96 | { |
||
97 | if ($this->validList) { |
||
98 | return $this->validList; |
||
99 | } |
||
100 | |||
101 | $all = $this->getAll(); |
||
102 | |||
103 | $this->validList = collect([]); |
||
104 | foreach ($all as $route) { |
||
105 | if (!empty($route->uri) && $route->uri != '#') { |
||
106 | $this->validList->push($route); |
||
107 | } |
||
108 | } |
||
109 | return $this->validList; |
||
110 | }*/ |
||
111 | |||
112 | /** |
||
113 | * 获取权限列表 |
||
114 | * |
||
115 | * @return \Illuminate\Support\Collection|null |
||
116 | */ |
||
117 | /*public function getPermRouteList() |
||
118 | { |
||
119 | if ($this->permList) { |
||
120 | return $this->permList; |
||
121 | } |
||
122 | |||
123 | return $this->permList = $this->getLayerOfDescendants(0); |
||
124 | }*/ |
||
125 | |||
126 | public function getMenuList() |
||
143 | |||
144 | /*public function getInfoById($id) |
||
145 | { |
||
146 | return $this->getSelf($id); |
||
147 | } |
||
148 | |||
149 | public function getInfoByName($name) |
||
150 | { |
||
151 | $all = $this->getAll(); |
||
152 | $key = $all->search(function ($item) use ($name) { |
||
153 | return $item->name == $name; |
||
154 | }); |
||
155 | return $key === false ? false : $all->get($key); |
||
156 | }*/ |
||
157 | |||
158 | /*public function getParentTree($id) |
||
159 | { |
||
160 | return $this->getAncestors($id); |
||
161 | } |
||
162 | |||
163 | public function getParentTreeAndSelfById($id) |
||
164 | { |
||
165 | $self = $this->getInfoById($id); |
||
166 | if ($self) { |
||
167 | $parent = $this->getParentTree($self->id); |
||
168 | $parent->push($self); |
||
169 | return $parent; |
||
170 | } |
||
171 | return false; |
||
172 | } |
||
173 | |||
174 | public function getParentTreeAndSelfByName($name) |
||
175 | { |
||
176 | $self = $this->getInfoByName($name); |
||
177 | if ($self) { |
||
178 | $parent = $this->getParentTree($self->id); |
||
179 | $parent->push($self); |
||
180 | return $parent; |
||
181 | } |
||
182 | return false; |
||
183 | }*/ |
||
184 | |||
185 | public function saveMenu(Request $request) |
||
206 | |||
207 | /** |
||
208 | * 删除菜单 |
||
209 | * |
||
210 | * @param int|array $ids 菜单ID |
||
211 | * |
||
212 | * @return bool |
||
213 | */ |
||
214 | public function deleteMenu($ids) |
||
237 | |||
238 | private function clearCache() |
||
242 | } |
||
243 |
This check marks private properties in classes that are never used. Those properties can be removed.