Code Duplication    Length = 23-23 lines in 2 locations

src/Http/Controllers/SekolahController.php 2 locations

@@ 218-240 (lines=23) @@
215
            'user_id'           => "required|exists:{$this->user->getTable()},id",
216
        ]);
217
218
        if ($validator->fails()) {
219
            $error      = true;
220
            $message    = $validator->errors()->first();
221
        } else {
222
            $sekolah->nama              = $request->input('nama');
223
            $sekolah->npsn              = $request->input('npsn');
224
            $sekolah->jenis_sekolah_id  = $request->input('jenis_sekolah_id');
225
            $sekolah->alamat            = $request->input('alamat');
226
            $sekolah->logo              = $request->input('logo');
227
            $sekolah->foto_gedung       = $request->input('foto_gedung');
228
            $sekolah->province_id       = $request->input('province_id');
229
            $sekolah->city_id           = $request->input('city_id');
230
            $sekolah->district_id       = $request->input('district_id');
231
            $sekolah->village_id        = $request->input('village_id');
232
            $sekolah->no_telp           = $request->input('no_telp');
233
            $sekolah->email             = $request->input('email');
234
            $sekolah->kode_zona         = $request->input('kode_zona');
235
            $sekolah->user_id           = $request->input('user_id');
236
            $sekolah->save();
237
238
            $error      = false;
239
            $message    = 'Success';
240
        }
241
242
        $response['error']      = $error;
243
        $response['message']    = $message;
@@ 327-349 (lines=23) @@
324
            'user_id'           => "required|exists:{$this->user->getTable()},id",
325
        ]);
326
327
        if ($validator->fails()) {
328
            $error      = true;
329
            $message    = $validator->errors()->first();
330
        } else {
331
            $sekolah->nama              = $request->input('nama');
332
            $sekolah->npsn              = $request->input('npsn');
333
            $sekolah->jenis_sekolah_id  = $request->input('jenis_sekolah_id');
334
            $sekolah->alamat            = $request->input('alamat');
335
            $sekolah->logo              = $request->input('logo');
336
            $sekolah->foto_gedung       = $request->input('foto_gedung');
337
            $sekolah->province_id       = $request->input('province_id');
338
            $sekolah->city_id           = $request->input('city_id');
339
            $sekolah->district_id       = $request->input('district_id');
340
            $sekolah->village_id        = $request->input('village_id');
341
            $sekolah->no_telp           = $request->input('no_telp');
342
            $sekolah->email             = $request->input('email');
343
            $sekolah->kode_zona         = $request->input('kode_zona');
344
            $sekolah->user_id           = $request->input('user_id');
345
            $sekolah->save();
346
347
            $error      = false;
348
            $message    = 'Success';
349
        }
350
351
        $response['error']      = $error;
352
        $response['message']    = $message;