public
function
search_customer(
Request
$request){
if(
$request->
ajax()){
$output =
'';
$query =
$request->
get(
'query');
if(
$query !=
''){
$get_customer =
DB::
table(
'tabel_master_customer')
->
where([
[
'deleted_at',
NULL],
[
'kode_mitra',
'BMM'],
[
'nama_customer',
'LIKE',
'%'.
$query.
'%']
])
->
get();
}
else{
$get_customer =
DB::
table(
'tabel_master_customer')
->
where([
[
'deleted_at',
NULL],
[
'kode_mitra',
'BMM'],
])
->
get();
}
if(
count(
$get_customer) >
0){
foreach(
$get_customer as
$gc){
$output .=
'<input type="checkbox" class="form-control" name="customer[]" value="'.
$gc->
kode_customer.
'">'.
$gc->
nama_customer.
'';
}
}
else{
$output .=
'data not found';
}
$data = [
'search_customer' =>
$output
];
return
response()->
json(
$data);
}
}