add api gadai customer base on cawangan
This commit is contained in:
@@ -71,6 +71,31 @@ class CustomerController extends Controller
|
|||||||
return response()->json($gadai_all);
|
return response()->json($gadai_all);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showOneCustomerGadaiByCawangan($ic,$status,$kodcaw){
|
||||||
|
if($status == 'belum_tebus'){
|
||||||
|
$gadai_status = '';
|
||||||
|
}elseif($status == 'sudah_tebus'){
|
||||||
|
$gadai_status = 'T';
|
||||||
|
}elseif($status == 'lelong'){
|
||||||
|
$gadai_status = 'L';
|
||||||
|
}
|
||||||
|
|
||||||
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->get();
|
||||||
|
|
||||||
|
if($status == 'belum_tebus' || $status == 'sudah_tebus'){
|
||||||
|
$gadai = Gadai::on($cawangan['mysql'])
|
||||||
|
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
|
||||||
|
->get();
|
||||||
|
}elseif($status == 'lelong'){
|
||||||
|
$gadai = Gadai::on($cawangan['mysql'])
|
||||||
|
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
|
||||||
|
->rightJoin('lelong', 'gadai.norujukan', '=', 'lelong.norujukan')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($gadai);
|
||||||
|
}
|
||||||
|
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
|||||||
// $router->get('customers/{id}',['uses'=>'CustomerController@showOneCustomer']);
|
// $router->get('customers/{id}',['uses'=>'CustomerController@showOneCustomer']);
|
||||||
$router->get('customers/{ic}',['uses'=>'CustomerController@showOneCustomerByIC']);
|
$router->get('customers/{ic}',['uses'=>'CustomerController@showOneCustomerByIC']);
|
||||||
$router->get('customers/{ic}/gadai/{status}',['uses'=>'CustomerController@showOneCustomerGadai']);
|
$router->get('customers/{ic}/gadai/{status}',['uses'=>'CustomerController@showOneCustomerGadai']);
|
||||||
|
$router->get('customers/{ic}/gadai/{status}/{kodcaw}',['uses'=>'CustomerController@showOneCustomerGadaiByCawangan']);
|
||||||
$router->post('customers',['uses'=>'CustomerController@create']);
|
$router->post('customers',['uses'=>'CustomerController@create']);
|
||||||
$router->delete('customers/{id}', ['uses' => 'CustomerController@delete']);
|
$router->delete('customers/{id}', ['uses' => 'CustomerController@delete']);
|
||||||
$router->put('customers/{id}', ['uses' => 'CustomerController@update']);
|
$router->put('customers/{id}', ['uses' => 'CustomerController@update']);
|
||||||
|
|||||||
Reference in New Issue
Block a user