add api for all gadai by customer
This commit is contained in:
@@ -50,5 +50,12 @@ DB_DATABASE_6=koklanas
|
||||
DB_USERNAME_6=root
|
||||
DB_PASSWORD_6=
|
||||
|
||||
DB_CONNECTION_7=mysql
|
||||
DB_HOST_7=127.0.0.1
|
||||
DB_PORT_7=3306
|
||||
DB_DATABASE_7=online_arrahn
|
||||
DB_USERNAME_7=root
|
||||
DB_PASSWORD_7=
|
||||
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
|
||||
@@ -10,7 +10,7 @@ class CawanganController extends Controller
|
||||
|
||||
public function showAllCawangans()
|
||||
{
|
||||
return response()->json(Cawangan::all());
|
||||
return response()->json(Cawangan::on('mysql7')->get());
|
||||
}
|
||||
|
||||
public function showOneCawangan($code_cawangan)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Gadai;
|
||||
use App\Cawangan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GadaiController extends Controller
|
||||
@@ -13,9 +14,26 @@ class GadaiController extends Controller
|
||||
return response()->json(Gadai::all());
|
||||
}
|
||||
|
||||
public function showOneGadai($id)
|
||||
public function gadaiTransactionByCawanganAndDay($cawangan_code,$date){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$cawangan_code)->first();
|
||||
|
||||
$gadaiTransaction = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$date)->get();
|
||||
|
||||
return response()->json($gadaiTransaction);
|
||||
}
|
||||
|
||||
public function showOneGadai($noic)
|
||||
{
|
||||
return response()->json(Gadai::find($id));
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$gadai_all = [];
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('nokp','=',$noic)->get();
|
||||
if(sizeof($gadai) != 0){
|
||||
array_push($gadai_all,$gadai);
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($gadai_all);
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
|
||||
+2
-1
@@ -30,10 +30,11 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
|
||||
//Gadai API
|
||||
$router->get('gadai',['uses'=>'GadaiController@showAllGadais']);
|
||||
$router->get('gadai/{id}',['uses'=>'GadaiController@showOneGadai']);
|
||||
$router->get('gadai/{noic}',['uses'=>'GadaiController@showOneGadai']);
|
||||
$router->post('gadai',['uses'=>'GadaiController@create']);
|
||||
$router->delete('gadai/{id}', ['uses' => 'GadaiController@delete']);
|
||||
$router->put('gadai/{id}', ['uses' => 'GadaiController@update']);
|
||||
$router->get('gadai/{cawangan_code}/{date}',['uses'=>'GadaiController@gadaiTransactionByCawanganAndDay']);
|
||||
|
||||
//Lelong API
|
||||
$router->get('lelong',['uses'=>'LelongController@showAllLelongs']);
|
||||
|
||||
Reference in New Issue
Block a user