Code Duplication    Length = 10-20 lines in 2 locations

src/Http/Controllers/SiswaController.php 2 locations

@@ 200-219 (lines=20) @@
197
     * @param  \Illuminate\Http\Request  $request
198
     * @return \Illuminate\Http\Response
199
     */
200
    public function show($id)
201
    {
202
        
203
        $siswa = $this->siswa->findOrFail($id);
204
205
                    
206
        array_set($siswa, 'user', $siswa->user->name);
207
        array_set($siswa, 'sekolah', $siswa->sekolah->label);
208
209
        
210
        $response['siswa'] = $siswa;
211
        $response['sekolah'] = $siswa; 
212
        $response['status'] = true;
213
214
        
215
216
        return response()->json($response);
217
218
        
219
    }
220
    /**
221
     * Show the form for editing the specified resource.
222
     *
@@ 226-235 (lines=10) @@
223
     * @param  \App\Siswa  $siswa
224
     * @return \Illuminate\Http\Response
225
     */
226
    public function edit($id)
227
    {
228
        $siswa = $this->siswa->findOrFail($id);
229
        array_set($siswa->user, 'label', $siswa->user->name);
230
        //dd($siswa->user);
231
        $response['siswa'] = $siswa;
232
        $response['user'] = $siswa->user;
233
        $response['status'] = true;
234
        return response()->json($response);
235
    }
236
    /**
237
     * Update the specified resource in storage.
238
     *