Code Duplication    Length = 14-15 lines in 3 locations

src/Http/Controllers/ProdiSekolahController.php 2 locations

@@ 187-200 (lines=14) @@
184
     * @param  \Illuminate\Http\Request  $request
185
     * @return \Illuminate\Http\Response
186
     */
187
    public function show($id)
188
     {
189
         $prodi_sekolah = $this->prodi_sekolah->findOrFail($id);
190
191
         array_set($prodi_sekolah, 'user', $prodi_sekolah->user->name);
192
         array_set($prodi_sekolah, 'sekolah', $prodi_sekolah->sekolah->label);
193
         array_set($prodi_sekolah, 'program_keahlian', $prodi_sekolah->program_keahlian->label);
194
195
         $response['sekolah']           = $prodi_sekolah;
196
         $response['program_keahlian']  = $prodi_sekolah;
197
         $response['status']            = true;
198
199
         return response()->json($response);
200
     }
201
202
    /**
203
     * Show the form for editing the specified resource.
@@ 208-222 (lines=15) @@
205
     * @param  \App\Sekolah  $sekolah
206
     * @return \Illuminate\Http\Response
207
     */
208
    public function edit($id)
209
    {
210
        $prodi_sekolah = $this->prodi_sekolah->findOrFail($id);
211
212
        array_set($prodi_sekolah->user, 'label', $prodi_sekolah->user->name);
213
        array_set($prodi_sekolah->program_keahlian, 'program_keahlian', $prodi_sekolah->program_keahlian->label);
214
215
        $response['user']               = $prodi_sekolah->user;
216
        $response['sekolah']            = $prodi_sekolah;
217
        $response['prodi_sekolah']      = $prodi_sekolah->sekolah;
218
        $Response['program_keahlian']   = $prodi_sekolah->program_keahlian;
219
        $response['status'] = true;
220
221
        return response()->json($response);
222
    }
223
224
    /**
225
     * Update the specified resource in storage.

src/Http/Controllers/SekolahController.php 1 location

@@ 199-212 (lines=14) @@
196
     * @param  \App\Sekolah  $sekolah
197
     * @return \Illuminate\Http\Response
198
     */
199
    public function edit($id)
200
    {
201
        $sekolah = $this->sekolah->findOrFail($id);
202
203
        array_set($sekolah->jenis_sekolah, 'label', $sekolah->jenis_sekolah->jenis_sekolah);
204
        array_set($sekolah->user, 'label', $sekolah->user->name);
205
206
        $response['sekolah'] = $sekolah;
207
        $response['user'] = $sekolah->user;
208
        $response['jenis_sekolah'] = $sekolah->jenis_sekolah;
209
        $response['status'] = true;
210
211
        return response()->json($response);
212
    }
213
214
    /**
215
     * Update the specified resource in storage.