Code Duplication    Length = 14-15 lines in 3 locations

src/Http/Controllers/SekolahController.php 1 location

@@ 182-195 (lines=14) @@
179
     * @param  \App\Sekolah  $sekolah
180
     * @return \Illuminate\Http\Response
181
     */
182
    public function edit($id)
183
    {
184
        $sekolah = $this->sekolah->findOrFail($id);
185
186
        array_set($sekolah->jenis_sekolah, 'label', $sekolah->jenis_sekolah->jenis_sekolah);
187
        array_set($sekolah->user, 'label', $sekolah->user->name);
188
189
        $response['sekolah'] = $sekolah;
190
        $response['user'] = $sekolah->user;
191
        $response['jenis_sekolah'] = $sekolah->jenis_sekolah;
192
        $response['status'] = true;
193
194
        return response()->json($response);
195
    }
196
197
    /**
198
     * Update the specified resource in storage.

src/Http/Controllers/ProdiSekolahController.php 2 locations

@@ 171-184 (lines=14) @@
168
     * @param  \Illuminate\Http\Request  $request
169
     * @return \Illuminate\Http\Response
170
     */
171
    public function show($id)
172
     {
173
         $prodi_sekolah = $this->prodi_sekolah->findOrFail($id);
174
175
         array_set($prodi_sekolah, 'user', $prodi_sekolah->user->name);
176
         array_set($prodi_sekolah, 'sekolah', $prodi_sekolah->sekolah->label);
177
         array_set($prodi_sekolah, 'program_keahlian', $prodi_sekolah->program_keahlian->label);
178
179
         $response['sekolah']           = $prodi_sekolah;
180
         $response['program_keahlian']  = $prodi_sekolah;
181
         $response['status']            = true;
182
183
         return response()->json($response);
184
     }
185
186
    /**
187
     * Show the form for editing the specified resource.
@@ 192-206 (lines=15) @@
189
     * @param  \App\Sekolah  $sekolah
190
     * @return \Illuminate\Http\Response
191
     */
192
    public function edit($id)
193
    {
194
        $prodi_sekolah = $this->prodi_sekolah->findOrFail($id);
195
196
        array_set($prodi_sekolah->user, 'label', $prodi_sekolah->user->name);
197
        array_set($prodi_sekolah->program_keahlian, 'program_keahlian', $prodi_sekolah->program_keahlian->label);
198
199
        $response['user']               = $prodi_sekolah->user;
200
        $response['sekolah']            = $prodi_sekolah;
201
        $response['prodi_sekolah']      = $prodi_sekolah->sekolah;
202
        $Response['program_keahlian']   = $prodi_sekolah->program_keahlian;
203
        $response['status'] = true;
204
205
        return response()->json($response);
206
    }
207
208
    /**
209
     * Update the specified resource in storage.