Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
class PegawaiController extends Controller
public function index()
return view('pegawai');
public function find_NIP(Request $request)
$nip = $request->get('nip');
if($request->ajax()) {
$data = '';
$qry = DB::select("SELECT * FROM pegawai where nip='$nip'");
foreach ($qry as $pgw) {
$data = array(
'nama_pegawai' => $pgw->nama_pegawai,
'alamat' => $pgw->alamat
echo json_encode($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment