API Mobile
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\BankMaster;
|
||||
use App\Customer;
|
||||
use App\Gadai;
|
||||
use App\Lelong;
|
||||
@@ -418,4 +419,79 @@ class CustomerController extends Controller
|
||||
|
||||
return response('Deleted Successfully', 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function akaunBankMobile($nokp)
|
||||
{
|
||||
$array_cust = [];
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
|
||||
foreach($cawangan_all as $cawangan)
|
||||
{
|
||||
$customer = Customer::on($cawangan['mysql'])
|
||||
->where('kplama','=',$nokp)
|
||||
->orWhere('kpbaru','=',$nokp)
|
||||
->rightJoin('online_arrahn.bank', 'bank.id', '=', 'customer.kodbank')
|
||||
->first();
|
||||
|
||||
if(!empty($customer))
|
||||
{
|
||||
$customer_detail['noakaun'] = $customer['noakaun'];
|
||||
$customer_detail['namabank'] = $customer['name'];
|
||||
$customer_detail['kodbank'] = $customer['id'];
|
||||
|
||||
return response()->json($customer_detail);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json('Data Not Found');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function bankListMobile()
|
||||
{
|
||||
$bank_array = [];
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
foreach($cawangan_all as $cawangan)
|
||||
{
|
||||
$bank = BankMaster::get();
|
||||
if(!empty($bank))
|
||||
{
|
||||
//loop each array
|
||||
foreach($bank as $banklist)
|
||||
{
|
||||
array_push($bank_array, array(
|
||||
'kodbank' => $banklist->id,
|
||||
'namabank' => $banklist->name,
|
||||
));
|
||||
}
|
||||
return response()->json($bank_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json('Data Not Found');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function insertAkaunBankMobile(Request $request)
|
||||
{
|
||||
$cawangan_all = Cawangan::on('mysql7')->get(); //return all 8 branches
|
||||
foreach($cawangan_all as $index=>$cawangan)
|
||||
{
|
||||
$customer = Customer::on($cawangan['mysql']) //search Customer on dtabase cawangan (1-8)
|
||||
->where('kplama','=',$request->nokp)
|
||||
->orWhere('kpbaru','=',$request->nokp)
|
||||
->first();
|
||||
|
||||
if(!empty($customer))
|
||||
{
|
||||
$customer->kodbank = $request->kodbank;
|
||||
$customer->noakaun = $request->noakaun;
|
||||
$customer->save();
|
||||
}
|
||||
}
|
||||
return response()->json($customer, 200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user