add jenis emas and lelong api

This commit is contained in:
Zakwan Hamdan
2020-11-01 08:45:53 +08:00
parent 508270157c
commit 2486f10ff7
7 changed files with 167 additions and 20 deletions
+14 -3
View File
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Lelong;
use App\Cawangan;
use Illuminate\Http\Request;
class LelongController extends Controller
@@ -10,12 +11,22 @@ class LelongController extends Controller
public function showAllLelongs()
{
return response()->json(Lelong::all());
$cawangan_all = Cawangan::on('mysql7')->get();
$lelong_all = [];
foreach ($cawangan_all as $index => $cawangan){
$lelong = Lelong::on($cawangan['mysql'])->get();
if(sizeof($lelong) != 0){
array_push($lelong_all,$lelong);
}
}
return response()->json($lelong_all);
}
public function showOneLelong($id)
public function showAllLelongByCawangan($kodcaw)
{
return response()->json(Lelong::find($id));
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$lelong = Lelong::on($cawangan['mysql'])->get();
return response()->json($lelong);
}
public function create(Request $request)