Code Duplication    Length = 15-15 lines in 2 locations

src/Traits/HasRoles.php 1 location

@@ 120-134 (lines=15) @@
117
     *
118
     * @return HasRoles
119
     */
120
    public function removeRole(...$roles)
121
    {
122
        \collect($roles)
123
            ->flatten()
124
            ->map(function ($role) {
125
                $role = $this->getStoredRole($role);
126
                $this->roles()->detach($role);
127
128
                return $role;
129
            });
130
131
        $this->forgetCachedPermissions();
132
133
        return $this;
134
    }
135
136
    /**
137
     * Remove all current roles and set the given ones.

src/Traits/HasPermissions.php 1 location

@@ 90-104 (lines=15) @@
87
     * @return $this
88
     * @throws \Maklad\Permission\Exceptions\GuardDoesNotMatch
89
     */
90
    public function revokePermissionTo(...$permissions)
91
    {
92
        collect($permissions)
93
            ->flatten()
94
            ->map(function ($permission) {
95
                $permission = $this->getStoredPermission($permission);
96
                $this->permissions()->detach($permission);
97
98
                return $permission;
99
            });
100
101
        $this->forgetCachedPermissions();
102
103
        return $this;
104
    }
105
106
    /**
107
     * @param string|Permission $permission