fix skit2
This commit is contained in:
@@ -695,4 +695,45 @@ class CustomerController extends Controller
|
||||
|
||||
return response()->json($dataCustomer);
|
||||
}
|
||||
|
||||
|
||||
public function AdminsearchCustomerByName(Request $request)
|
||||
{
|
||||
$nama = strtoupper($request->nama);
|
||||
|
||||
if(empty($nama))
|
||||
{
|
||||
$customer = [];
|
||||
}else{
|
||||
$customer = Customer::on('mysql7')
|
||||
->where('nama','like',$nama.'%')
|
||||
->orWhere('nama','like','%'.$nama)
|
||||
->orWhere('nama','like','%'.$nama.'%')
|
||||
->take(3)
|
||||
->get();
|
||||
}
|
||||
|
||||
return response()->json($customer);
|
||||
}
|
||||
|
||||
public function AdminsearchCustomerByIC(Request $request)
|
||||
{
|
||||
if(isset($request->kodcaw))
|
||||
{
|
||||
$customer = Customer::on('mysql7')
|
||||
->where([['kplama','like',$request->ic.'%'],['kodcaw','=',$request->kodcaw]])
|
||||
->orWhere([['kpbaru','like',$request->ic.'%'],['kodcaw','=',$request->kodcaw]])
|
||||
->take(3)
|
||||
->get();
|
||||
}else{
|
||||
$customer = Customer::on('mysql7')
|
||||
->where('kplama','like',$request->ic.'%')
|
||||
->orWhere('kpbaru','like',$request->ic.'%')
|
||||
->take(3)
|
||||
->get();
|
||||
}
|
||||
|
||||
|
||||
return response()->json($customer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user