Code Duplication    Length = 10-11 lines in 2 locations

src/Http/Controllers/Users/RoleController.php 1 location

@@ 63-73 (lines=11) @@
60
        return response()->json(['message' => 'ok']);
61
    }
62
63
    public function destroy($id)
64
    {
65
        $role = Role::findOrFail($id);
66
        if ($role->name == 'admin') {
67
            throw new AdminHttpException('超级管理员角色不能删除');
68
        }
69
70
        $role->delete();
71
72
        return response()->json(['message' => 'ok']);
73
    }
74
75
    /**
76
     * 批量删除角色

src/Http/Controllers/Users/UserController.php 1 location

@@ 51-60 (lines=10) @@
48
        return response()->json(['message' => 'ok']);
49
    }
50
51
    public function delete($id)
52
    {
53
        if ($id == 1) {
54
            throw new AdminHttpException('超级管理员不能删除');
55
        }
56
57
        $model = $this->getUserModel()->findOrFail($id);
58
        $model->delete();
59
        return response()->json(['message' => 'ok']);
60
    }
61
62
    public function saveRole(Request $request)
63
    {