| @@ 220-239 (lines=20) @@ | ||
| 217 | if ($validator->fails()) { |
|
| 218 | $error = true; |
|
| 219 | $message = $validator->errors()->first(); |
|
| 220 | } else { |
|
| 221 | $sekolah->nama = $request->input('nama'); |
|
| 222 | $sekolah->npsn = $request->input('npsn'); |
|
| 223 | $sekolah->jenis_sekolah_id = $request->input('jenis_sekolah_id'); |
|
| 224 | $sekolah->alamat = $request->input('alamat'); |
|
| 225 | $sekolah->logo = $request->input('logo'); |
|
| 226 | $sekolah->foto_gedung = $request->input('foto_gedung'); |
|
| 227 | $sekolah->province_id = $request->input('province_id'); |
|
| 228 | $sekolah->city_id = $request->input('city_id'); |
|
| 229 | $sekolah->district_id = $request->input('district_id'); |
|
| 230 | $sekolah->village_id = $request->input('village_id'); |
|
| 231 | $sekolah->no_telp = $request->input('no_telp'); |
|
| 232 | $sekolah->email = $request->input('email'); |
|
| 233 | $sekolah->kode_zona = $request->input('kode_zona'); |
|
| 234 | $sekolah->user_id = $request->input('user_id'); |
|
| 235 | $sekolah->save(); |
|
| 236 | ||
| 237 | $error = false; |
|
| 238 | $message = 'Success'; |
|
| 239 | } |
|
| 240 | ||
| 241 | $response['error'] = $error; |
|
| 242 | $response['message'] = $message; |
|
| @@ 334-351 (lines=18) @@ | ||
| 331 | if($check_npsn->count() > 0 || $check_user->count() > 0){ |
|
| 332 | $response['message'] = implode("\n",$message); |
|
| 333 | ||
| 334 | } else { |
|
| 335 | $sekolah->label = $request->input('label'); |
|
| 336 | $sekolah->jenis_sekolah_id = $request->input('jenis_sekolah_id'); |
|
| 337 | $sekolah->npsn = $request->input('npsn'); |
|
| 338 | $sekolah->alamat = $request->input('alamat'); |
|
| 339 | $sekolah->logo = $request->input('logo'); |
|
| 340 | $sekolah->foto_gedung = $request->input('foto_gedung'); |
|
| 341 | $sekolah->province_id = $request->input('province_id'); |
|
| 342 | $sekolah->city_id = $request->input('city_id'); |
|
| 343 | $sekolah->district_id = $request->input('district_id'); |
|
| 344 | $sekolah->village_id = $request->input('village_id'); |
|
| 345 | $sekolah->no_telp = $request->input('no_telp'); |
|
| 346 | $sekolah->email = $request->input('email'); |
|
| 347 | $sekolah->kode_zona = $request->input('kode_zona'); |
|
| 348 | $sekolah->user_id = $request->input('user_id'); |
|
| 349 | $sekolah->save(); |
|
| 350 | $response['message'] = 'success'; |
|
| 351 | } |
|
| 352 | ||
| 353 | } else { |
|
| 354 | $sekolah->label = $request->input('label'); |
|
| @@ 353-370 (lines=18) @@ | ||
| 350 | $response['message'] = 'success'; |
|
| 351 | } |
|
| 352 | ||
| 353 | } else { |
|
| 354 | $sekolah->label = $request->input('label'); |
|
| 355 | $sekolah->jenis_sekolah_id = $request->input('jenis_sekolah_id'); |
|
| 356 | $sekolah->npsn = $request->input('npsn'); |
|
| 357 | $sekolah->alamat = $request->input('alamat'); |
|
| 358 | $sekolah->logo = $request->input('logo'); |
|
| 359 | $sekolah->foto_gedung = $request->input('foto_gedung'); |
|
| 360 | $sekolah->province_id = $request->input('province_id'); |
|
| 361 | $sekolah->city_id = $request->input('city_id'); |
|
| 362 | $sekolah->district_id = $request->input('district_id'); |
|
| 363 | $sekolah->village_id = $request->input('village_id'); |
|
| 364 | $sekolah->no_telp = $request->input('no_telp'); |
|
| 365 | $sekolah->email = $request->input('email'); |
|
| 366 | $sekolah->kode_zona = $request->input('kode_zona'); |
|
| 367 | $sekolah->user_id = $request->input('user_id'); |
|
| 368 | $sekolah->save(); |
|
| 369 | $response['message'] = 'success'; |
|
| 370 | } |
|
| 371 | ||
| 372 | $response['status'] = true; |
|
| 373 | return response()->json($response); |
|