Code Duplication    Length = 24-24 lines in 2 locations

src/Http/Controllers/SekolahController.php 2 locations

@@ 186-209 (lines=24) @@
183
            'user_id'           => "required|exists:{$this->user->getTable()},id",
184
        ]);
185
186
        if ($validator->fails()) {
187
            $error      = true;
188
            $message    = $validator->errors()->first();
189
        } else {
190
            $sekolah->id                = $request->input('npsn');
191
            $sekolah->nama              = $request->input('nama');
192
            $sekolah->npsn              = $request->input('npsn');
193
            $sekolah->jenis_sekolah_id  = $request->input('jenis_sekolah_id');
194
            $sekolah->alamat            = $request->input('alamat');
195
            $sekolah->logo              = $request->input('logo');
196
            $sekolah->foto_gedung       = $request->input('foto_gedung');
197
            $sekolah->province_id       = $request->input('province_id');
198
            $sekolah->city_id           = $request->input('city_id');
199
            $sekolah->district_id       = $request->input('district_id');
200
            $sekolah->village_id        = $request->input('village_id');
201
            $sekolah->no_telp           = $request->input('no_telp');
202
            $sekolah->email             = $request->input('email');
203
            $sekolah->kode_zona         = $request->input('kode_zona');
204
            $sekolah->user_id           = $request->input('user_id');
205
            $sekolah->save();
206
207
            $error      = false;
208
            $message    = 'Success';
209
        }
210
211
        $response['error']      = $error;
212
        $response['message']    = $message;
@@ 338-361 (lines=24) @@
335
            'user_id'           => "required|exists:{$this->user->getTable()},id",
336
        ]);
337
338
        if ($validator->fails()) {
339
            $error      = true;
340
            $message    = $validator->errors()->first();
341
        } else {
342
            $sekolah->id                = $request->input('npsn');
343
            $sekolah->nama              = $request->input('nama');
344
            $sekolah->npsn              = $request->input('npsn');
345
            $sekolah->jenis_sekolah_id  = $request->input('jenis_sekolah_id');
346
            $sekolah->alamat            = $request->input('alamat');
347
            $sekolah->logo              = $request->input('logo');
348
            $sekolah->foto_gedung       = $request->input('foto_gedung');
349
            $sekolah->province_id       = $request->input('province_id');
350
            $sekolah->city_id           = $request->input('city_id');
351
            $sekolah->district_id       = $request->input('district_id');
352
            $sekolah->village_id        = $request->input('village_id');
353
            $sekolah->no_telp           = $request->input('no_telp');
354
            $sekolah->email             = $request->input('email');
355
            $sekolah->kode_zona         = $request->input('kode_zona');
356
            $sekolah->user_id           = $request->input('user_id');
357
            $sekolah->save();
358
359
            $error      = false;
360
            $message    = 'Success';
361
        }
362
363
        $response['error']      = $error;
364
        $response['message']    = $message;