change to api

This commit is contained in:
Zakwan Hamdan
2020-11-01 12:44:44 +08:00
parent 5f104396e6
commit ac9c0b94cf
6 changed files with 287 additions and 71 deletions
+5 -1
View File
@@ -45,7 +45,11 @@ class CustomersController extends Controller
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json();
$customer_info = $customers_info[0];
if(sizeof($customers_info)!= 0){
$customer_info = $customers_info[0];
}else{
$customer_info = $customers_info;
}
$search = true;
if($customer_info){
+6 -1
View File
@@ -4,6 +4,9 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\HargaEmas;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Auth;
class HargaEmasController extends Controller
{
@@ -13,7 +16,9 @@ class HargaEmasController extends Controller
}
public function index(){
$auth_user = Auth::user();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
$harga_emas = HargaEmas::all();
return view('harga_emas.index',compact('harga_emas'));
return view('harga_emas.index',compact('harga_emas','cawangan_info'));
}
}
+7 -2
View File
@@ -14,9 +14,14 @@ class MarhunController extends Controller
$this->middleware('auth');
}
public function index(){
public function index(Request $request){
$norujukan = $request->norujukan;
$auth_user = Auth::user();
$jemas = Http::get(config('api.url') . '/api/jemas/'. $auth_user['cawangan'])->json();
$hargaemas = Http::get(config('api.url') . '/api/harga_emas')->json();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('marhun.index',compact('cawangan_info'));
return view('marhun.index',compact('cawangan_info','norujukan','jemas','hargaemas'));
}
}