Browse Source

菜单按钮

cqpCow 1 năm trước cách đây
mục cha
commit
6244e32148
1 tập tin đã thay đổi với 10 bổ sung5 xóa
  1. 10 5
      app/Service/EmployeeService.php

+ 10 - 5
app/Service/EmployeeService.php

@@ -662,13 +662,18 @@ class EmployeeService extends Service
             ->select('menu_id','type')
             ->get()->toArray();
         $button = $this->fillRoleButton($role_id);
+        $tmp = [];
         foreach ($search as $value){
-            $object[] = [
-                'menu_id' => $value['menu_id'],
-                'type' => $value['type'],
-                'button' => $button[$value['menu_id']] ?? [],
-            ];
+            if(! in_array($value['menu_id'],$tmp)){
+                $object[] = [
+                    'menu_id' => $value['menu_id'],
+                    'type' => $value['type'],
+                    'button' => $button[$value['menu_id']] ?? [],
+                ];
+                $tmp[] = $value['menu_id'];
+            }
         }
+        unset($tmp);
 
         return $object;
     }