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

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