Modified API and created its tests

This commit is contained in:
Gregorio Chiko Putra
2019-05-09 15:44:27 +07:00
parent b0553839d0
commit a82b6f0af5
7 changed files with 154 additions and 5 deletions

View File

@@ -30,9 +30,7 @@ Route::post('/siswa', function (Request $request) {
// Redirect with error if not found
if (!$siswa || $siswa == null) {
return redirect()->back()
->withErrors(['siswa' => 'Siswa tidak ditemukan.'])
->withInput();
return response()->json(['siswa' => 'Siswa tidak ditemukan.'], 404);
}
// Write to log