all()); $logsession = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw) ->create([ 'nama' => $request->nama, 'nokp' => $request->nokp, 'kodcaw' => $request->kodcaw, 'email' => $request->email, 'taraf' => $request->taraf, ]); return response()->json($logsession); } public function checkNokpSession($kodcaw, $nokp, $tarikh) { $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); $checknokp = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw) ->where('nokp', '=', $nokp) ->where('created_at','LIKE',"%{$tarikh}%") ->get(); if (sizeof($checknokp) != 0) { $newnokp = $nokp; } else { $newnokp = 'NULL'; } return response()->json($newnokp); } }