Procházet zdrojové kódy

修改角色修权限过滤

ajun před 5 roky
rodič
revize
0a8a01ae30
1 změnil soubory, kde provedl 6 přidání a 8 odebrání
  1. 6 8
      app/Authority.php

+ 6 - 8
app/Authority.php

@@ -38,15 +38,13 @@ class Authority extends Model
     public  static  function  filterRecycle(Collection $authorities)
     {
         $owners = Owner::query()->whereNotNull("deleted_at")->get();
-        $owner_names = $owners->map(function($owner){
-            if (mb_strpos($owner->name,"(停用)")){
-                $name =  mb_substr($owner->name,0,mb_stripos($owner->name,"(停用)"));
-                return "(货主:{$name})";
-            }
-            return "(货主:{$owner->name})";
+
+        $owner_keys = $owners->map(function($owner){
+            return '_'.$owner['id'];
         })->toArray();
-        return $authorities->filter(function ($authority)use($owner_names){
-            return !in_array($authority->alias_name,$owner_names);
+
+        return $authorities->filter(function ($authority)use($owner_keys){
+            return !in_array($authority->name,$owner_keys);
         });
     }
 }