add api for status gadai
This commit is contained in:
+5
-5
@@ -18,35 +18,35 @@ DB_PASSWORD=
|
|||||||
DB_CONNECTION_2=mysql
|
DB_CONNECTION_2=mysql
|
||||||
DB_HOST_2=127.0.0.1
|
DB_HOST_2=127.0.0.1
|
||||||
DB_PORT_2=3306
|
DB_PORT_2=3306
|
||||||
DB_DATABASE_2=arrahn_kangar
|
DB_DATABASE_2=kangar
|
||||||
DB_USERNAME_2=root
|
DB_USERNAME_2=root
|
||||||
DB_PASSWORD_2=
|
DB_PASSWORD_2=
|
||||||
|
|
||||||
DB_CONNECTION_3=mysql
|
DB_CONNECTION_3=mysql
|
||||||
DB_HOST_3=127.0.0.1
|
DB_HOST_3=127.0.0.1
|
||||||
DB_PORT_3=3306
|
DB_PORT_3=3306
|
||||||
DB_DATABASE_3=arrahn_kauntan
|
DB_DATABASE_3=kauntan
|
||||||
DB_USERNAME_3=root
|
DB_USERNAME_3=root
|
||||||
DB_PASSWORD_3=
|
DB_PASSWORD_3=
|
||||||
|
|
||||||
DB_CONNECTION_4=mysql
|
DB_CONNECTION_4=mysql
|
||||||
DB_HOST_4=127.0.0.1
|
DB_HOST_4=127.0.0.1
|
||||||
DB_PORT_4=3306
|
DB_PORT_4=3306
|
||||||
DB_DATABASE_4=arrahn_pmas
|
DB_DATABASE_4=pmas
|
||||||
DB_USERNAME_4=root
|
DB_USERNAME_4=root
|
||||||
DB_PASSWORD_4=
|
DB_PASSWORD_4=
|
||||||
|
|
||||||
DB_CONNECTION_5=mysql
|
DB_CONNECTION_5=mysql
|
||||||
DB_HOST_5=127.0.0.1
|
DB_HOST_5=127.0.0.1
|
||||||
DB_PORT_5=3306
|
DB_PORT_5=3306
|
||||||
DB_DATABASE_5=arrahn_putatan
|
DB_DATABASE_5=putatan
|
||||||
DB_USERNAME_5=root
|
DB_USERNAME_5=root
|
||||||
DB_PASSWORD_5=
|
DB_PASSWORD_5=
|
||||||
|
|
||||||
DB_CONNECTION_6=mysql
|
DB_CONNECTION_6=mysql
|
||||||
DB_HOST_6=127.0.0.1
|
DB_HOST_6=127.0.0.1
|
||||||
DB_PORT_6=3306
|
DB_PORT_6=3306
|
||||||
DB_DATABASE_6=arrahn_koklanas
|
DB_DATABASE_6=koklanas
|
||||||
DB_USERNAME_6=root
|
DB_USERNAME_6=root
|
||||||
DB_PASSWORD_6=
|
DB_PASSWORD_6=
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Customer;
|
use App\Customer;
|
||||||
|
use App\Gadai;
|
||||||
|
use App\Lelong;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CustomerController extends Controller
|
class CustomerController extends Controller
|
||||||
@@ -28,6 +30,29 @@ class CustomerController extends Controller
|
|||||||
return response()->json($customer);
|
return response()->json($customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showOneCustomerGadai($ic,$status){
|
||||||
|
if($status == 'belum_tebus'){
|
||||||
|
$gadai_status = '';
|
||||||
|
}elseif($status == 'sudah_tebus'){
|
||||||
|
$gadai_status = 'T';
|
||||||
|
}elseif($status == 'lelong'){
|
||||||
|
$gadai_status = 'L';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($status == 'belum_tebus' || $status == 'sudah_tebus'){
|
||||||
|
$gadai = Gadai::on('mysql2')
|
||||||
|
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
|
||||||
|
->get();
|
||||||
|
}elseif($status == 'lelong'){
|
||||||
|
$gadai = Gadai::on('mysql2')
|
||||||
|
->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)
|
||||||
{
|
{
|
||||||
$customer = Customer::create($request->all());
|
$customer = Customer::create($request->all());
|
||||||
|
|||||||
+3
-2
@@ -21,8 +21,9 @@ $router->get('/', function () use ($router) {
|
|||||||
$router->group(['prefix'=>'api'], function () use ($router){
|
$router->group(['prefix'=>'api'], function () use ($router){
|
||||||
//Customer API
|
//Customer API
|
||||||
$router->get('customers',['uses'=>'CustomerController@showAllCustomers']);
|
$router->get('customers',['uses'=>'CustomerController@showAllCustomers']);
|
||||||
$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->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