Code Duplication    Length = 14-14 lines in 2 locations

src/Http/Controllers/PermissionsController.php 1 location

@@ 154-167 (lines=14) @@
151
     * @param \Yajra\Acl\Models\Permission $permission
152
     * @return \Illuminate\Http\RedirectResponse
153
     */
154
    public function destroy(Permission $permission)
155
    {
156
        if (! $permission->system) {
157
            try {
158
                $permission->delete();
159
160
                return $this->notifySuccess('Permission successfully deleted!');
161
            } catch (QueryException $e) {
162
                return $this->notifyError($e->getMessage());
163
            }
164
        }
165
166
        return $this->notifyError('System permission is protected and cannot be deleted!');
167
    }
168
}
169

src/Http/Controllers/RolesController.php 1 location

@@ 113-126 (lines=14) @@
110
     * @param \Yajra\Acl\Models\Role $role
111
     * @return \Illuminate\Http\RedirectResponse
112
     */
113
    public function destroy(Role $role)
114
    {
115
        if (! $role->system) {
116
            try {
117
                $role->delete();
118
119
                return $this->notifySuccess('Role successfully deleted!');
120
            } catch (QueryException $e) {
121
                return $this->notifyError($e->getMessage());
122
            }
123
        }
124
125
        return $this->notifyError('Role is protected and cannot be deleted!');
126
    }
127
}
128