Code Duplication    Length = 12-12 lines in 2 locations

src/Http/Controllers/AdminSekolahController.php 2 locations

@@ 177-188 (lines=12) @@
174
            'user_id'               => "required|exists:{$this->user->getTable()},id",
175
        ]);
176
177
        if ($validator->fails()) {
178
            $error      = true;
179
            $message    = $validator->errors()->first();
180
        } else {
181
            $admin_sekolah->sekolah_id          = $request->input('sekolah_id');
182
            $admin_sekolah->admin_sekolah_id    = $request->input('admin_sekolah_id');
183
            $admin_sekolah->user_id             = $request->input('user_id');
184
            $admin_sekolah->save();
185
186
            $error      = false;
187
            $message    = 'Success';
188
        }
189
190
        $response['admin_sekolah']  = $admin_sekolah;
191
        $response['error']          = $error;
@@ 288-299 (lines=12) @@
285
            'user_id'               => "required|exists:{$this->user->getTable()},id",
286
        ]);
287
288
        if ($validator->fails()) {
289
            $error      = true;
290
            $message    = $validator->errors()->first();
291
        } else {
292
            $admin_sekolah->sekolah_id          = $request->input('sekolah_id');
293
            $admin_sekolah->admin_sekolah_id    = $request->input('admin_sekolah_id');
294
            $admin_sekolah->user_id             = $request->input('user_id');
295
            $admin_sekolah->save();
296
297
            $error      = false;
298
            $message    = 'Success';
299
        }
300
301
        $response['admin_sekolah']  = $admin_sekolah;
302
        $response['error']          = $error;