Code Duplication    Length = 14-14 lines in 2 locations

app/Http/Controllers/DepartmentController.php 1 location

@@ 128-141 (lines=14) @@
125
     *
126
     * @return string
127
     */
128
    public function get_departments()
129
    {
130
        $items = Departments::all();
131
        $data2 = [];
132
133
        foreach($items as $department) {
134
            $data2[] = [
135
                'value' => $department["id"],
136
                'text'  => $department["name"]
137
            ];
138
        }
139
140
        return json_encode($data2);
141
    }    
142
}
143

app/Http/Controllers/StaffController.php 1 location

@@ 153-166 (lines=14) @@
150
        return redirect()->to('/staff');
151
    }
152
153
    public function get_roles()
154
    {
155
        $items = Roles::all();
156
        $data2 = [];
157
        foreach($items as $role)
158
        {
159
         $data2[] = [
160
        'value' => $role["id"],
161
        'text'  => $role["name"]
162
        ];
163
164
        }
165
        return json_encode($data2);
166
    } 
167
168
}
169