Created
July 6, 2020 02:00
-
-
Save blogcacanid/b84d27208bd567e2e9b7a9d6bfa2b619 to your computer and use it in GitHub Desktop.
PegawaiController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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