Code Duplication    Length = 14-14 lines in 2 locations

app/Http/Controllers/DepartmentController.php 1 location

@@ 109-122 (lines=14) @@
106
        return redirect()->back(302);
107
    }
108
109
    public function get_departments()
110
    {
111
        $items = Departments::all();
112
        $data2 = [];
113
        foreach($items as $department)
114
        {
115
         $data2[] = [
116
        'value' => $department["id"],
117
        'text'  => $department["name"]
118
        ];
119
120
        }
121
        return json_encode($data2);
122
    }    
123
}
124

app/Http/Controllers/StaffController.php 1 location

@@ 146-159 (lines=14) @@
143
        return redirect()->to('/staff');
144
    }
145
146
    public function get_roles()
147
    {
148
        $items = Roles::all();
149
        $data2 = [];
150
        foreach($items as $role)
151
        {
152
         $data2[] = [
153
        'value' => $role["id"],
154
        'text'  => $role["name"]
155
        ];
156
157
        }
158
        return json_encode($data2);
159
    } 
160
161
}
162