customer
This commit is contained in:
@@ -30,7 +30,7 @@ class CustomerController extends Controller
|
||||
public function getLatestCustomer($kodcaw){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$customer = Customer::on($cawangan['mysql'])->orderBy('tarikh','desc')->orderBy('nosiri','desc')->first();
|
||||
$customer = Customer::on($cawangan['mysql'])->orderBy('tarikhdaftar','desc')->orderBy('nosiri','desc')->first();
|
||||
|
||||
return response()->json($customer);
|
||||
}
|
||||
@@ -61,6 +61,30 @@ class CustomerController extends Controller
|
||||
return response()->json($customer_all);
|
||||
}
|
||||
|
||||
public function showOneCustomerByICMobile($ic){
|
||||
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$customer_all = [];
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$customer = Customer::on($cawangan['mysql'])
|
||||
->where('kplama','=',$ic)
|
||||
->orWhere('kpbaru','=',$ic)
|
||||
->first();
|
||||
if($customer != null){
|
||||
array_push($customer_all,$customer);
|
||||
}
|
||||
}
|
||||
$customer_detail['nama'] = $customer_all[0]['nama'];
|
||||
$customer_detail['nokp'] = $customer_all[0]['kpbaru'];
|
||||
$customer_detail['nopelanggan'] = $customer_all[0]['nopelanggan'];
|
||||
$customer_detail['telefon'] = $customer_all[0]['telefon'];
|
||||
$customer_detail['telefon2'] = $customer_all[0]['telefon2'];
|
||||
$customer_detail['alamat'] = $customer_all[0]['alamat1'];
|
||||
$customer_detail['poskod'] = $customer_all[0]['poskod'];
|
||||
|
||||
return response()->json($customer_detail);
|
||||
}
|
||||
|
||||
public function showOneCustomerGadai($ic,$status){
|
||||
if($status == 'belum_tebus'){
|
||||
$gadai_status = '';
|
||||
@@ -120,6 +144,7 @@ class CustomerController extends Controller
|
||||
}
|
||||
|
||||
public function create($kodcaw,Request $request){
|
||||
dd($request);
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
@@ -146,7 +171,8 @@ class CustomerController extends Controller
|
||||
'noakaun' => $request->noakaun,
|
||||
'teller' => $request->teller,
|
||||
'aktif' => 'A',
|
||||
'telefon2' => $request->telefon2
|
||||
'telefon2' => $request->telefon2,
|
||||
'nosiri'=>$request->nosiri
|
||||
]);
|
||||
|
||||
return response()->json($customer, 201);
|
||||
|
||||
@@ -23,6 +23,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
$router->get('customers',['uses'=>'CustomerController@showAllCustomers']);
|
||||
$router->get('customers/cawangan/{kodcaw}',['uses'=>'CustomerController@showAllCustomersByCawangan']);
|
||||
$router->get('customers/{ic}',['uses'=>'CustomerController@showOneCustomerByIC']);
|
||||
$router->get('customers/mobile/{ic}',['uses'=>'CustomerController@showOneCustomerByICMobile']);
|
||||
$router->get('customers/{ic}/gadai/{status}',['uses'=>'CustomerController@showOneCustomerGadai']);
|
||||
$router->get('customers/{ic}/gadai/{status}/{kodcaw}',['uses'=>'CustomerController@showOneCustomerGadaiByCawangan']);
|
||||
$router->post('customers/{kodcaw}',['uses'=>'CustomerController@create']);
|
||||
|
||||
Reference in New Issue
Block a user