Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created July 6, 2020 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blogcacanid/b84d27208bd567e2e9b7a9d6bfa2b619 to your computer and use it in GitHub Desktop.
Save blogcacanid/b84d27208bd567e2e9b7a9d6bfa2b619 to your computer and use it in GitHub Desktop.
PegawaiController.php
<?php
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