Code Duplication    Length = 8-9 lines in 3 locations

app/Models/ProjectGroupRoleModel.php 2 locations

@@ 131-138 (lines=8) @@
128
     *
129
     * @return bool
130
     */
131
    public function addGroup($project_id, $group_id, $role)
132
    {
133
        return $this->db->table(self::TABLE)->insert([
134
            'group_id'   => $group_id,
135
            'project_id' => $project_id,
136
            'role'       => $role,
137
        ]);
138
    }
139
140
    /**
141
     * Remove a group from the project.
@@ 162-170 (lines=9) @@
159
     *
160
     * @return bool
161
     */
162
    public function changeGroupRole($project_id, $group_id, $role)
163
    {
164
        return $this->db->table(self::TABLE)
165
            ->eq('group_id', $group_id)
166
            ->eq('project_id', $project_id)
167
            ->update([
168
                'role' => $role,
169
            ]);
170
    }
171
172
    /**
173
     * Copy group access from a project to another one.

app/Models/ProjectUserRoleModel.php 1 location

@@ 222-229 (lines=8) @@
219
     *
220
     * @return bool
221
     */
222
    public function addUser($project_id, $user_id, $role)
223
    {
224
        return $this->db->table(self::TABLE)->insert([
225
            'user_id'    => $user_id,
226
            'project_id' => $project_id,
227
            'role'       => $role,
228
        ]);
229
    }
230
231
    /**
232
     * Remove a user.