Ver Fonte

权限:货主关联权限增加联动子项删除

Zhouzhendong há 5 anos atrás
pai
commit
a00c05f8d8
1 ficheiros alterados com 5 adições e 2 exclusões
  1. 5 2
      app/Services/OwnerService.php

+ 5 - 2
app/Services/OwnerService.php

@@ -355,8 +355,11 @@ sql
      */
     public function deleteAuthority($owner)
     {
-        Authority::query()->where('name',"_{$owner['id']}")
+        $authorities = Authority::query()->where('name',"_{$owner['id']}")
             ->where("alias_name","like","(货主%")
-            ->delete();
+            ->get(["id"]);
+        $ids = array_column($authorities->toArray(),"id");
+        DB::table("authority_role")->whereIn("id_authority",$ids)->delete();
+        Authority::destroy($ids);
     }
 }