Updated request variable, updated api test
This commit is contained in:
@@ -18,17 +18,16 @@ Route::post('/siswa', function (Request $request) {
|
||||
// Auto redirect on fail
|
||||
Validator::make($request->all(), [
|
||||
'nisn' => 'required|regex:/^[0-9]+$/',
|
||||
'tglLahir' => 'required|regex:/^[0-9]+$/',
|
||||
'tanggalLahir' => 'required|regex:/^[0-9]+$/',
|
||||
], [
|
||||
'required' => 'Kolom :attribute harus diisi.',
|
||||
'string' => 'Kolom :attribute tidak sesuai.',
|
||||
'regex' => 'Kolom :attribute tidak sesuai.',
|
||||
])->validate();
|
||||
|
||||
// Look for the given inputs in the resource
|
||||
$tglLahir = Carbon\Carbon::parse($request->tglLahir);
|
||||
$tanggalLahir = Carbon\Carbon::parse($request->tanggalLahir)->format('Y-m-d');
|
||||
$siswa = App\Siswa::where('nisn', $request->nisn)
|
||||
->where('tanggal_lahir', $tglLahir)
|
||||
->where('tanggal_lahir', $tanggalLahir)
|
||||
->first();
|
||||
|
||||
// Redirect with error if not found
|
||||
|
||||
Reference in New Issue
Block a user