<?php

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
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index(){
        $auth_user = Auth::user();
        $cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
        $harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/harga_emas')->json();
        return view('harga_emas.index',compact('harga_emas','cawangan_info'));
    }
}
